{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6acba732-3a34-4f40-ad9a-a46ef4ed74c7",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "384e9d81-a209-46b7-8063-f5938462b554",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "✔ MADL and Standard scorers created\n",
      "🚀 All functions loaded successfully! Ready to run the trading system.\n"
     ]
    }
   ],
   "source": [
    "# COMPREHENSIVE COMPARISON: STANDARD vs MADL WITH MACRO DATA + BUY-AND-HOLD BENCHMARK\n",
    "\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "from datetime import datetime, timedelta\n",
    "import os\n",
    "import warnings\n",
    "from sklearn.model_selection import TimeSeriesSplit, RandomizedSearchCV\n",
    "from sklearn.metrics import make_scorer, accuracy_score\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "from sklearn.neural_network import MLPClassifier\n",
    "from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier, AdaBoostClassifier\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "from xgboost import XGBClassifier\n",
    "import xgboost as xgb\n",
    "from scipy.optimize import minimize\n",
    "\n",
    "warnings.filterwarnings('ignore')\n",
    "\n",
    "# ========== CONFIGURATION ==========\n",
    "# Added CNY_USD to the currency pairs list\n",
    "CURRENCY_PAIRS = ['EUR_USD', 'JPY_USD', 'AUD_USD', 'CHF_USD', 'MXN_USD', 'ZAR_USD', 'TRY_USD', 'CNY_USD']\n",
    "\n",
    "PERIODS = [\n",
    "    ('2018-01-01', '2020-03-10'),\n",
    "    ('2020-03-11', '2021-03-11'),\n",
    "    ('2021-03-12', '2023-12-31'),\n",
    "    ('2018-01-01', '2023-12-31')\n",
    "]\n",
    "\n",
    "FOREX_FILE = 'ml_tc_data_g.xlsx'\n",
    "MACRO_FILE = 'ml_tc_data_g.xlsx'  # Updated macro file name\n",
    "\n",
    "# ========== MADL LOSS IMPLEMENTATION ==========\n",
    "def madl_loss(y_true, y_pred_proba, returns_magnitude=None, threshold=0.5):\n",
    "    \"\"\"\n",
    "    Mean Absolute Directional Loss (MADL) for algorithmic trading\n",
    "    \n",
    "    This loss function is designed specifically for generating signals for AIS.\n",
    "    It considers the forecast error's direction and the actual return magnitude.\n",
    "    \n",
    "    MADL = (1/N) * Σ(-1) × sign(Ri × R̂i) × abs(Ri)\n",
    "    \n",
    "    where:\n",
    "    - Ri is the observed return magnitude\n",
    "    - R̂i is the predicted return direction\n",
    "    - sign(X) returns -1, 0, or 1\n",
    "    - abs(X) is the absolute value\n",
    "    \"\"\"\n",
    "    # Debug print to verify MADL is being called\n",
    "    print(f\"    🔧 MADL loss function called with {len(y_true)} samples\")\n",
    "    \n",
    "    # Handle 2D probability arrays\n",
    "    if hasattr(y_pred_proba, 'shape') and len(y_pred_proba.shape) > 1:\n",
    "        y_pred_proba = y_pred_proba[:, 1]\n",
    "    \n",
    "    # Convert probabilities to binary predictions\n",
    "    y_pred = (y_pred_proba > threshold).astype(int)\n",
    "    \n",
    "    # Convert binary labels to directional signals (-1 for down, +1 for up)\n",
    "    true_direction = 2 * np.array(y_true) - 1  # Maps 0->-1, 1->+1\n",
    "    pred_direction = 2 * y_pred - 1  # Maps 0->-1, 1->+1\n",
    "    \n",
    "    # Use actual returns magnitude if provided, otherwise use unit returns\n",
    "    if returns_magnitude is not None:\n",
    "        actual_returns = np.abs(returns_magnitude)  # Use actual return magnitudes\n",
    "        print(f\"    📊 Using actual returns, range: [{actual_returns.min():.4f}, {actual_returns.max():.4f}]\")\n",
    "    else:\n",
    "        actual_returns = np.ones(len(y_true))  # Fallback to unit returns\n",
    "        print(f\"    📊 No returns provided, using unit returns\")\n",
    "    \n",
    "    # Calculate MADL according to equation (6) from the paper\n",
    "    # MADL = (1/N) * Σ(-1) × sign(true_direction × pred_direction) × abs(returns)\n",
    "    # Note: true_direction already encodes the sign of the return\n",
    "    directional_accuracy = np.sign(true_direction * pred_direction)\n",
    "    madl = np.mean(-1 * directional_accuracy * actual_returns)\n",
    "    \n",
    "    print(f\"    📊 MADL score: {madl:.4f}\")\n",
    "    return madl\n",
    "\n",
    "# Custom MADL Logistic Regression - FIXED VERSION\n",
    "class MADLLogisticRegression:\n",
    "    \"\"\"\n",
    "    Custom Logistic Regression that optimizes MADL loss instead of log loss\n",
    "    This implementation directly minimizes the MADL objective function\n",
    "    FIXED: Prevents zero-solution convergence\n",
    "    \"\"\"\n",
    "    \n",
    "    def __init__(self, C=1.0, max_iter=1000, random_state=42, learning_rate=0.1):\n",
    "        self.C = C  # Regularization parameter\n",
    "        self.max_iter = max_iter\n",
    "        self.random_state = random_state\n",
    "        self.learning_rate = learning_rate\n",
    "        self.coef_ = None\n",
    "        self.intercept_ = None\n",
    "        self.n_features_ = None\n",
    "        self.returns_magnitude_ = None\n",
    "        self.classes_ = np.array([0, 1])\n",
    "        \n",
    "    def _sigmoid(self, z):\n",
    "        \"\"\"Stable sigmoid function\"\"\"\n",
    "        return 1 / (1 + np.exp(-np.clip(z, -500, 500)))\n",
    "    \n",
    "    def _madl_loss_function(self, params, X, y, returns_magnitude):\n",
    "        \"\"\"\n",
    "        MADL loss function for optimization\n",
    "        \n",
    "        Parameters:\n",
    "        -----------\n",
    "        params : array\n",
    "            Model parameters [weights, bias]\n",
    "        X : array\n",
    "            Feature matrix\n",
    "        y : array\n",
    "            Binary labels (0 or 1)\n",
    "        returns_magnitude : array\n",
    "            Magnitude of returns for each sample\n",
    "        \"\"\"\n",
    "        # Extract parameters\n",
    "        w = params[:-1]\n",
    "        b = params[-1]\n",
    "        \n",
    "        # Calculate predictions\n",
    "        z = X.dot(w) + b\n",
    "        y_pred_proba = self._sigmoid(z)\n",
    "        \n",
    "        # Convert to directions\n",
    "        true_direction = 2 * y - 1  # Maps 0->-1, 1->+1\n",
    "        pred_direction = 2 * (y_pred_proba > 0.5) - 1\n",
    "        \n",
    "        # MADL loss: penalize wrong predictions weighted by return magnitude\n",
    "        directional_accuracy = np.sign(true_direction * pred_direction)\n",
    "        madl_loss = np.mean(-directional_accuracy * np.abs(returns_magnitude))\n",
    "        \n",
    "        # Add L2 regularization\n",
    "        reg_term = (1 / (2 * self.C)) * np.sum(w**2)\n",
    "        \n",
    "        total_loss = madl_loss + reg_term\n",
    "        \n",
    "        return total_loss\n",
    "    \n",
    "    def _gradient_descent_madl(self, X, y, returns_magnitude):\n",
    "        \"\"\"\n",
    "        Custom gradient descent optimization for MADL - FIXED VERSION\n",
    "        \"\"\"\n",
    "        n_samples, n_features = X.shape\n",
    "        \n",
    "        # Initialize with standard logistic regression solution\n",
    "        from sklearn.linear_model import LogisticRegression\n",
    "        std_model = LogisticRegression(C=self.C, random_state=self.random_state, max_iter=500)\n",
    "        std_model.fit(X, y)\n",
    "        \n",
    "        # Use standard solution as starting point with some perturbation\n",
    "        np.random.seed(self.random_state)\n",
    "        w = std_model.coef_[0] + np.random.randn(n_features) * 0.1\n",
    "        b = std_model.intercept_[0] + np.random.randn() * 0.1\n",
    "        \n",
    "        best_loss = float('inf')\n",
    "        best_w = w.copy()\n",
    "        best_b = b\n",
    "        \n",
    "        # Scale returns for better gradient flow\n",
    "        returns_scale = 100.0\n",
    "        scaled_returns = np.abs(returns_magnitude) * returns_scale\n",
    "        \n",
    "        # Track if we're making progress\n",
    "        loss_history = []\n",
    "        patience = 100  # Reduced patience\n",
    "        min_improvement = 1e-6\n",
    "        no_improvement_count = 0\n",
    "        \n",
    "        for iteration in range(self.max_iter):\n",
    "            # Forward pass\n",
    "            z = X.dot(w) + b\n",
    "            y_pred_proba = self._sigmoid(z)\n",
    "            \n",
    "            # Calculate MADL loss with SCALED returns\n",
    "            true_direction = 2 * y - 1\n",
    "            pred_direction = 2 * (y_pred_proba > 0.5) - 1\n",
    "            directional_accuracy = np.sign(true_direction * pred_direction)\n",
    "            \n",
    "            # Use scaled returns for loss calculation\n",
    "            madl_loss = np.mean(-directional_accuracy * scaled_returns) / returns_scale\n",
    "            \n",
    "            # Add regularization\n",
    "            reg_loss = (1 / (2 * self.C)) * np.sum(w**2)\n",
    "            total_loss = madl_loss + reg_loss\n",
    "            \n",
    "            # Track best parameters\n",
    "            if total_loss < best_loss - min_improvement:\n",
    "                best_loss = total_loss\n",
    "                best_w = w.copy()\n",
    "                best_b = b\n",
    "                no_improvement_count = 0\n",
    "            else:\n",
    "                no_improvement_count += 1\n",
    "            \n",
    "            # Early stopping check\n",
    "            loss_history.append(total_loss)\n",
    "            if no_improvement_count > patience:\n",
    "                print(f\"      Early stopping at iteration {iteration}\")\n",
    "                break\n",
    "            \n",
    "            # Calculate gradients using finite differences\n",
    "            grad_w = np.zeros_like(w)\n",
    "            grad_b = 0\n",
    "            eps = 1e-6\n",
    "            \n",
    "            # Gradient for weights\n",
    "            for i in range(n_features):\n",
    "                w_plus = w.copy()\n",
    "                w_plus[i] += eps\n",
    "                \n",
    "                z_plus = X.dot(w_plus) + b\n",
    "                y_pred_plus = self._sigmoid(z_plus)\n",
    "                pred_dir_plus = 2 * (y_pred_plus > 0.5) - 1\n",
    "                acc_plus = np.sign(true_direction * pred_dir_plus)\n",
    "                loss_plus = np.mean(-acc_plus * scaled_returns) / returns_scale + (1/(2*self.C)) * np.sum(w_plus**2)\n",
    "                \n",
    "                grad_w[i] = (loss_plus - total_loss) / eps\n",
    "            \n",
    "            # Gradient for bias\n",
    "            b_plus = b + eps\n",
    "            z_plus = X.dot(w) + b_plus\n",
    "            y_pred_plus = self._sigmoid(z_plus)\n",
    "            pred_dir_plus = 2 * (y_pred_plus > 0.5) - 1\n",
    "            acc_plus = np.sign(true_direction * pred_dir_plus)\n",
    "            loss_plus = np.mean(-acc_plus * scaled_returns) / returns_scale + (1/(2*self.C)) * np.sum(w**2)\n",
    "            grad_b = (loss_plus - total_loss) / eps\n",
    "            \n",
    "            # Adaptive learning rate\n",
    "            current_lr = self.learning_rate\n",
    "            if iteration > 200:\n",
    "                current_lr = self.learning_rate * 0.5\n",
    "            if iteration > 400:\n",
    "                current_lr = self.learning_rate * 0.1\n",
    "            \n",
    "            # Update parameters with momentum\n",
    "            momentum = 0.9\n",
    "            if not hasattr(self, 'v_w'):\n",
    "                self.v_w = np.zeros_like(w)\n",
    "                self.v_b = 0\n",
    "            \n",
    "            self.v_w = momentum * self.v_w - current_lr * grad_w\n",
    "            self.v_b = momentum * self.v_b - current_lr * grad_b\n",
    "            \n",
    "            w += self.v_w\n",
    "            b += self.v_b\n",
    "            \n",
    "            # Prevent complete convergence to zero\n",
    "            if np.linalg.norm(w) < 0.1:\n",
    "                w = best_w  # Reset to best known weights\n",
    "                b = best_b\n",
    "                print(f\"      ⚠️ Warning: Weights too small, resetting to best known solution\")\n",
    "                break\n",
    "            \n",
    "            if iteration % 100 == 0:\n",
    "                print(f\"      Iteration {iteration}: MADL Loss = {madl_loss:.4f}, Total Loss = {total_loss:.4f}\")\n",
    "        \n",
    "        # Final check: if solution is too close to zero, use a blend with standard solution\n",
    "        if np.linalg.norm(best_w) < 0.5:\n",
    "            print(f\"      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\")\n",
    "            # Blend MADL solution with standard solution\n",
    "            alpha = 0.7  # Weight for standard solution\n",
    "            best_w = alpha * std_model.coef_[0] + (1 - alpha) * best_w\n",
    "            best_b = alpha * std_model.intercept_[0] + (1 - alpha) * best_b\n",
    "        \n",
    "        return best_w, best_b, best_loss\n",
    "    \n",
    "    def fit(self, X, y, returns_magnitude=None):\n",
    "        \"\"\"\n",
    "        Fit the model by minimizing MADL loss\n",
    "        \n",
    "        Parameters:\n",
    "        -----------\n",
    "        X : array-like of shape (n_samples, n_features)\n",
    "            Training features\n",
    "        y : array-like of shape (n_samples,)\n",
    "            Binary target values (0 or 1)\n",
    "        returns_magnitude : array-like of shape (n_samples,), optional\n",
    "            Magnitude of returns for each sample. If None, uses unit returns.\n",
    "        \"\"\"\n",
    "        np.random.seed(self.random_state)\n",
    "        \n",
    "        # Store dimensions\n",
    "        self.n_features_ = X.shape[1]\n",
    "        \n",
    "        # Handle returns magnitude\n",
    "        if returns_magnitude is None:\n",
    "            # Use direction as proxy (unit returns)\n",
    "            self.returns_magnitude_ = np.ones(len(y))\n",
    "            print(\"    📊 MADL Logistic: Using unit returns (no magnitude data)\")\n",
    "        else:\n",
    "            self.returns_magnitude_ = np.abs(returns_magnitude)\n",
    "            print(f\"    📊 MADL Logistic: Using actual returns, range: [{self.returns_magnitude_.min():.4f}, {self.returns_magnitude_.max():.4f}]\")\n",
    "            print(f\"    📊 MADL Logistic: Mean return magnitude: {self.returns_magnitude_.mean():.4f}\")\n",
    "            print(f\"    📊 MADL Logistic: Std return magnitude: {self.returns_magnitude_.std():.4f}\")\n",
    "        \n",
    "        # Use custom gradient descent for MADL optimization\n",
    "        print(\"    🔧 Optimizing MADL loss function using custom gradient descent...\")\n",
    "        self.coef_, self.intercept_, final_loss = self._gradient_descent_madl(X, y, self.returns_magnitude_)\n",
    "        \n",
    "        print(f\"    ✓ MADL optimization completed! Final loss: {final_loss:.4f}\")\n",
    "        \n",
    "        # Compare with standard logistic regression for debugging\n",
    "        from sklearn.linear_model import LogisticRegression\n",
    "        std_model = LogisticRegression(C=self.C, max_iter=self.max_iter, random_state=self.random_state)\n",
    "        std_model.fit(X, y)\n",
    "        \n",
    "        print(f\"    📊 MADL vs Standard coefficient comparison:\")\n",
    "        print(f\"       MADL intercept: {self.intercept_:.4f}, Standard intercept: {std_model.intercept_[0]:.4f}\")\n",
    "        print(f\"       MADL coef norm: {np.linalg.norm(self.coef_):.4f}, Standard coef norm: {np.linalg.norm(std_model.coef_):.4f}\")\n",
    "        print(f\"       Coefficient difference norm: {np.linalg.norm(self.coef_ - std_model.coef_[0]):.4f}\")\n",
    "        \n",
    "        return self\n",
    "    \n",
    "    def predict_proba(self, X):\n",
    "        \"\"\"Predict class probabilities\"\"\"\n",
    "        z = X.dot(self.coef_) + self.intercept_\n",
    "        proba_class_1 = self._sigmoid(z)\n",
    "        proba_class_0 = 1 - proba_class_1\n",
    "        return np.column_stack([proba_class_0, proba_class_1])\n",
    "    \n",
    "    def predict(self, X):\n",
    "        \"\"\"Predict class labels\"\"\"\n",
    "        proba = self.predict_proba(X)\n",
    "        return (proba[:, 1] > 0.5).astype(int)\n",
    "    \n",
    "    def score(self, X, y):\n",
    "        \"\"\"Return the mean accuracy\"\"\"\n",
    "        return np.mean(self.predict(X) == y)\n",
    "\n",
    "# Create scorers with verbose output\n",
    "# Modified to pass returns_magnitude to MADL scorer\n",
    "def make_madl_scorer_with_returns(returns_magnitude):\n",
    "    \"\"\"Create a MADL scorer that includes returns magnitude\"\"\"\n",
    "    def madl_wrapper(y_true, y_pred_proba):\n",
    "        return madl_loss(y_true, y_pred_proba, returns_magnitude=returns_magnitude)\n",
    "    return make_scorer(madl_wrapper, greater_is_better=False, needs_proba=True)\n",
    "\n",
    "accuracy_scorer = make_scorer(accuracy_score, greater_is_better=True)\n",
    "\n",
    "print(\"✔ MADL and Standard scorers created\")\n",
    "\n",
    "# ========== DATA LOADING FUNCTIONS ==========\n",
    "def load_macro_data_from_ml_tc_data_d(filename='ml_tc_data_d.xlsx', start_date=None, end_date=None):\n",
    "    \"\"\"Load macro data from ml_tc_data_d.xlsx\"\"\"\n",
    "    print(f\"📊 Loading macro data from: {filename}\")\n",
    "    \n",
    "    if not os.path.exists(filename):\n",
    "        print(f\"    ❌ File not found: {filename}\")\n",
    "        return None\n",
    "    \n",
    "    macro_data = {}\n",
    "    \n",
    "    # Sheet names to try for ml_tc_data_d.xlsx\n",
    "    sheet_variants = {\n",
    "        '5y_tbill': ['5_y_t_bill', '5y_tbill', '5Y_T_Bill', '5_year_treasury'],\n",
    "        '13w_tbill': ['13_w_t_bill', '13w_tbill', '13W_T_Bill', '13_week_treasury']\n",
    "    }\n",
    "    \n",
    "    for data_key, possible_sheets in sheet_variants.items():\n",
    "        loaded = False\n",
    "        for sheet_name in possible_sheets:\n",
    "            try:\n",
    "                df_raw = pd.read_excel(filename, sheet_name=sheet_name)\n",
    "                \n",
    "                # Find date column\n",
    "                date_col = None\n",
    "                for col in df_raw.columns:\n",
    "                    col_lower = str(col).lower()\n",
    "                    if 'date' in col_lower or col_lower in ['date', 'datetime', 'time']:\n",
    "                        date_col = col\n",
    "                        break\n",
    "                \n",
    "                if date_col is None:\n",
    "                    continue\n",
    "                \n",
    "                df_raw[date_col] = pd.to_datetime(df_raw[date_col], errors='coerce')\n",
    "                df_raw = df_raw.dropna(subset=[date_col])\n",
    "                df_raw = df_raw.set_index(date_col)\n",
    "                \n",
    "                if start_date:\n",
    "                    df_raw = df_raw[df_raw.index >= pd.to_datetime(start_date)]\n",
    "                if end_date:\n",
    "                    df_raw = df_raw[df_raw.index <= pd.to_datetime(end_date)]\n",
    "                \n",
    "                # Find value column\n",
    "                value_col = None\n",
    "                for col in df_raw.columns:\n",
    "                    col_lower = str(col).lower()\n",
    "                    if any(x in col_lower for x in ['close', 'value', 'rate', 'price']):\n",
    "                        value_col = col\n",
    "                        break\n",
    "                \n",
    "                if value_col:\n",
    "                    macro_data[data_key] = df_raw[value_col]\n",
    "                    print(f\"    ✔ Loaded {data_key}: {len(df_raw)} rows\")\n",
    "                    loaded = True\n",
    "                    break\n",
    "            except Exception:\n",
    "                continue\n",
    "        \n",
    "        if not loaded:\n",
    "            print(f\"    ⚠️ Could not load {data_key}\")\n",
    "    \n",
    "    if len(macro_data) == 2:\n",
    "        return macro_data\n",
    "    else:\n",
    "        print(f\"    ❌ Failed to load complete macro data\")\n",
    "        return None\n",
    "\n",
    "def load_forex_data(filename, sheet_name='EUR_USD', start_date=None, end_date=None):\n",
    "    \"\"\"Load forex data from Excel file\"\"\"\n",
    "    try:\n",
    "        if not os.path.exists(filename):\n",
    "            print(f\"Error: File not found - {filename}\")\n",
    "            return None\n",
    "        \n",
    "        df = pd.read_excel(filename, sheet_name=sheet_name)\n",
    "        df.columns = df.columns.str.capitalize()\n",
    "        df['Date'] = pd.to_datetime(df['Date'])\n",
    "        df = df.set_index('Date')\n",
    "        \n",
    "        if start_date:\n",
    "            df = df[df.index >= pd.to_datetime(start_date)]\n",
    "        if end_date:\n",
    "            df = df[df.index <= pd.to_datetime(end_date)]\n",
    "        \n",
    "        return df\n",
    "    except Exception as e:\n",
    "        print(f\"Error loading {sheet_name}: {e}\")\n",
    "        return None\n",
    "\n",
    "def prepare_features(forex_data, macro_data=None, include_macro=True):\n",
    "    \"\"\"Prepare features with optional macro data\"\"\"\n",
    "    df = forex_data.copy()\n",
    "    \n",
    "    # Technical features\n",
    "    df['Returns'] = df['Close'].pct_change()\n",
    "    df['Range'] = (df['High'] - df['Low']) / df['Close']\n",
    "    df['Gap'] = df['Open'] - df['Close'].shift(1)\n",
    "    \n",
    "    feature_columns = ['Returns', 'Range', 'Gap']\n",
    "    \n",
    "    if include_macro and macro_data is not None:\n",
    "        try:\n",
    "            df['5y_tbill'] = macro_data['5y_tbill'].reindex(df.index, method='ffill')\n",
    "            df['13w_tbill'] = macro_data['13w_tbill'].reindex(df.index, method='ffill')\n",
    "            df['yield_curve_slope'] = df['5y_tbill'] - df['13w_tbill']\n",
    "            df['5y_tbill_change'] = df['5y_tbill'].diff()\n",
    "            df['13w_tbill_change'] = df['13w_tbill'].diff()\n",
    "            df['yield_slope_change'] = df['yield_curve_slope'].diff()\n",
    "            \n",
    "            feature_columns.extend([\n",
    "                '5y_tbill', '13w_tbill', 'yield_curve_slope',\n",
    "                '5y_tbill_change', '13w_tbill_change', 'yield_slope_change'\n",
    "            ])\n",
    "            print(f\"    ✔ Added macro features (total features: {len(feature_columns)})\")\n",
    "        except Exception as e:\n",
    "            print(f\"    ⚠️ Could not add macro features: {e}\")\n",
    "    \n",
    "    return df[feature_columns]\n",
    "\n",
    "def split_period_data_by_actual_data(forex_data, train_ratio=0.75):\n",
    "    \"\"\"\n",
    "    Split forex data into train/test based on actual available data\n",
    "    \n",
    "    Parameters:\n",
    "    -----------\n",
    "    forex_data : pandas.DataFrame\n",
    "        The forex data for the period (already filtered by period dates)\n",
    "    train_ratio : float, default=0.75\n",
    "        Ratio of data to use for training (0.75 = 75% train, 25% test)\n",
    "    \n",
    "    Returns:\n",
    "    --------\n",
    "    train_data, test_data : pandas.DataFrame, pandas.DataFrame\n",
    "        Split data where train_data is first portion, test_data is last portion\n",
    "    \"\"\"\n",
    "    if forex_data is None or len(forex_data) < 20:\n",
    "        return None, None\n",
    "    \n",
    "    # Calculate split point\n",
    "    total_rows = len(forex_data)\n",
    "    train_size = int(total_rows * train_ratio)\n",
    "    \n",
    "    # Ensure minimum sizes\n",
    "    min_test_size = max(10, int(total_rows * 0.1))  # At least 10 days or 10% of data\n",
    "    train_size = min(train_size, total_rows - min_test_size)\n",
    "    \n",
    "    # Split the data chronologically\n",
    "    train_data = forex_data.iloc[:train_size]\n",
    "    test_data = forex_data.iloc[train_size:]\n",
    "    \n",
    "    return train_data, test_data\n",
    "\n",
    "def load_and_split_forex_data(filename, currency_pair, period_start, period_end, train_ratio=0.75):\n",
    "    \"\"\"\n",
    "    Load forex data for a period and split into train/test based on actual data\n",
    "    \n",
    "    Parameters:\n",
    "    -----------\n",
    "    filename : str\n",
    "        Excel file containing forex data\n",
    "    currency_pair : str\n",
    "        Currency pair sheet name\n",
    "    period_start : str\n",
    "        Start date of period (YYYY-MM-DD)\n",
    "    period_end : str\n",
    "        End date of period (YYYY-MM-DD)\n",
    "    train_ratio : float, default=0.75\n",
    "        Ratio of data to use for training\n",
    "    \n",
    "    Returns:\n",
    "    --------\n",
    "    train_data, test_data : pandas.DataFrame, pandas.DataFrame\n",
    "        Split forex data, or (None, None) if loading fails\n",
    "    \"\"\"\n",
    "    try:\n",
    "        # Load the full period data\n",
    "        if not os.path.exists(filename):\n",
    "            print(f\"    ❌ File not found: {filename}\")\n",
    "            return None, None\n",
    "        \n",
    "        df = pd.read_excel(filename, sheet_name=currency_pair)\n",
    "        df.columns = df.columns.str.capitalize()\n",
    "        df['Date'] = pd.to_datetime(df['Date'])\n",
    "        df = df.set_index('Date')\n",
    "        \n",
    "        # Filter by period dates\n",
    "        period_data = df[(df.index >= pd.to_datetime(period_start)) & \n",
    "                        (df.index <= pd.to_datetime(period_end))]\n",
    "        \n",
    "        if len(period_data) < 20:\n",
    "            print(f\"    ⚠️ Insufficient data for {currency_pair} in period {period_start} to {period_end}: {len(period_data)} days\")\n",
    "            return None, None\n",
    "        \n",
    "        # Split the actual available data\n",
    "        train_data, test_data = split_period_data_by_actual_data(period_data, train_ratio)\n",
    "        \n",
    "        print(f\"    ✅ {currency_pair}: Total={len(period_data)} days, Train={len(train_data)} days, Test={len(test_data)} days\")\n",
    "        print(f\"       📅 Train: {train_data.index.min().strftime('%Y-%m-%d')} to {train_data.index.max().strftime('%Y-%m-%d')}\")\n",
    "        print(f\"       📅 Test:  {test_data.index.min().strftime('%Y-%m-%d')} to {test_data.index.max().strftime('%Y-%m-%d')}\")\n",
    "        \n",
    "        return train_data, test_data\n",
    "        \n",
    "    except Exception as e:\n",
    "        print(f\"    ❌ Error loading {currency_pair}: {str(e)[:60]}...\")\n",
    "        return None, None\n",
    "\n",
    "# ========== BUY-AND-HOLD BENCHMARK CALCULATION ==========\n",
    "\n",
    "# ========== CORRECTED BUY-AND-HOLD BENCHMARK ==========\n",
    "\n",
    "def calculate_buy_and_hold_benchmark(open_prices, close_prices, initial_capital=10000):\n",
    "    \"\"\"Calculate buy-and-hold benchmark performance with CORRECTED Sharpe/Sortino\"\"\"\n",
    "    \n",
    "    # Buy at first open price, sell at last close price\n",
    "    initial_price = open_prices.iloc[0]\n",
    "    final_price = close_prices.iloc[-1]\n",
    "    \n",
    "    # Calculate returns\n",
    "    total_return = ((final_price - initial_price) / initial_price) * 100\n",
    "    final_value = initial_capital * (1 + total_return / 100)\n",
    "    \n",
    "    # Daily returns for Sharpe/Sortino calculation\n",
    "    daily_returns = close_prices.pct_change().dropna()\n",
    "    \n",
    "    # CORRECTED SHARPE AND SORTINO CALCULATIONS\n",
    "    if len(daily_returns) > 0:\n",
    "        # Risk-free rate\n",
    "        rf_annual = 0.04  # 4% annual\n",
    "        rf_daily = rf_annual / 252\n",
    "        \n",
    "        # Excess returns\n",
    "        excess_returns = daily_returns - rf_daily\n",
    "        \n",
    "        # CORRECTED Sharpe Ratio\n",
    "        if daily_returns.std() > 0:\n",
    "            sharpe = np.sqrt(252) * excess_returns.mean() / daily_returns.std()\n",
    "        else:\n",
    "            sharpe = 0\n",
    "        \n",
    "        # CORRECTED Sortino Ratio\n",
    "        downside_returns = excess_returns[excess_returns < 0]\n",
    "        \n",
    "        if len(downside_returns) > 0:\n",
    "            # Use standard deviation of downside returns (not RMS)\n",
    "            downside_std = downside_returns.std()\n",
    "            \n",
    "            if downside_std > 0:\n",
    "                sortino = np.sqrt(252) * excess_returns.mean() / downside_std\n",
    "            else:\n",
    "                sortino = 0\n",
    "        else:\n",
    "            # No downside returns\n",
    "            sortino = 100  # Cap at 100\n",
    "            \n",
    "        # Max drawdown remains the same\n",
    "        cum_returns = (1 + daily_returns).cumprod()\n",
    "        running_max = cum_returns.expanding().max()\n",
    "        drawdown = (cum_returns - running_max) / running_max\n",
    "        max_drawdown = drawdown.min() if len(drawdown) > 0 else 0\n",
    "    else:\n",
    "        sharpe = sortino = max_drawdown = 0\n",
    "    \n",
    "    return {\n",
    "        'final_value': final_value,\n",
    "        'total_return': total_return,\n",
    "        'sharpe': sharpe,\n",
    "        'sortino': sortino,\n",
    "        'max_drawdown': max_drawdown,\n",
    "        'trades': 1  # Buy-and-hold has only 1 trade\n",
    "    }\n",
    "# ========== FUTURE PERIOD CALCULATION ==========\n",
    "#def calculate_future_period(train_start, train_end):\n",
    " #   \"\"\"Calculate future period dates\"\"\"\n",
    "  #  start_dt = datetime.strptime(train_start, '%Y-%m-%d')\n",
    "   # end_dt = datetime.strptime(train_end, '%Y-%m-%d')\n",
    "    \n",
    "    #total_days = (end_dt - start_dt).days\n",
    "    #future_length = int(total_days * 0.25)\n",
    "    \n",
    "    #future_start = end_dt + timedelta(days=1)\n",
    "    #future_end = future_start + timedelta(days=future_length)\n",
    "    \n",
    "    #return future_start.strftime('%Y-%m-%d'), future_end.strftime('%Y-%m-%d')\n",
    "\n",
    "# ========== PROPER CV WITHOUT DATA LEAKAGE ==========\n",
    "def proper_time_series_validation(X_train_raw, y_train, model_class, param_grid,\n",
    "                                scorer, scorer_name, n_splits=3, returns_magnitude=None):\n",
    "    \"\"\"Proper CV with no data leakage - scales data within each fold\"\"\"\n",
    "    try:\n",
    "        total_samples = len(X_train_raw)\n",
    "        if total_samples < 50:  # Need more data for meaningful CV\n",
    "            print(f\"    ⚠️ Insufficient data for CV ({total_samples} samples)\")\n",
    "            return {\n",
    "                'cv_accuracy_mean': 0.5,\n",
    "                'cv_accuracy_std': 0,\n",
    "                'cv_folds_completed': 0\n",
    "            }\n",
    "        \n",
    "        fold_size = total_samples // (n_splits + 1)\n",
    "        cv_accuracies = []\n",
    "        completed_folds = 0\n",
    "        \n",
    "        print(f\"    🎯 Running {n_splits}-fold proper CV with {scorer_name} scorer...\")\n",
    "        \n",
    "        for fold in range(n_splits):\n",
    "            try:\n",
    "                # Progressive time series splits\n",
    "                train_end = fold_size * (fold + 1)\n",
    "                test_start = train_end\n",
    "                test_end = min(train_end + fold_size // 2, total_samples - 1)\n",
    "                \n",
    "                if test_end <= test_start or train_end >= total_samples:\n",
    "                    continue\n",
    "                \n",
    "                # Split RAW data (no scaling leakage)\n",
    "                X_fold_train_raw = X_train_raw[:train_end]\n",
    "                y_fold_train = y_train.iloc[:train_end] if hasattr(y_train, 'iloc') else y_train[:train_end]\n",
    "                \n",
    "                X_fold_test_raw = X_train_raw[test_start:test_end]\n",
    "                y_fold_test = y_train.iloc[test_start:test_end] if hasattr(y_train, 'iloc') else y_train[test_start:test_end]\n",
    "                \n",
    "                # Also split returns if provided\n",
    "                fold_returns_train = None\n",
    "                fold_returns_test = None\n",
    "                if returns_magnitude is not None:\n",
    "                    fold_returns_train = returns_magnitude[:train_end]\n",
    "                    fold_returns_test = returns_magnitude[test_start:test_end]\n",
    "                \n",
    "                if len(X_fold_train_raw) < 20 or len(X_fold_test_raw) < 5:\n",
    "                    continue\n",
    "                \n",
    "                # Scale data WITHIN this fold only (no leakage)\n",
    "                scaler_fold = StandardScaler()\n",
    "                X_fold_train_scaled = scaler_fold.fit_transform(X_fold_train_raw)\n",
    "                X_fold_test_scaled = scaler_fold.transform(X_fold_test_raw)\n",
    "                \n",
    "                # Simple model training (no hyperparameter optimization in CV)\n",
    "                # For MADL Logistic, use our custom class\n",
    "                if scorer_name == \"MADL\" and model_class.__name__ == \"LogisticRegression\":\n",
    "                    model_fold = MADLLogisticRegression(C=1.0, max_iter=1000, random_state=42 + fold)\n",
    "                    model_fold.fit(X_fold_train_scaled, y_fold_train, returns_magnitude=fold_returns_train)\n",
    "                else:\n",
    "                    model_fold = model_class(random_state=42 + fold)\n",
    "                    \n",
    "                    # Set reasonable defaults based on model type to prevent overfitting\n",
    "                    model_name = model_class.__name__\n",
    "                    if 'DecisionTree' in model_name or 'Tree' in model_name:\n",
    "                        model_fold.set_params(max_depth=5)  # Limit tree depth\n",
    "                    elif 'RandomForest' in model_name or 'Forest' in model_name:\n",
    "                        model_fold.set_params(max_depth=5, n_estimators=50)\n",
    "                    elif 'GradientBoosting' in model_name:\n",
    "                        model_fold.set_params(max_depth=3, n_estimators=50, learning_rate=0.1)\n",
    "                    elif 'XGB' in model_name:\n",
    "                        model_fold.set_params(max_depth=3, n_estimators=50, learning_rate=0.1,\n",
    "                                            use_label_encoder=False, eval_metric='logloss')\n",
    "                    elif 'AdaBoost' in model_name:\n",
    "                        model_fold.set_params(n_estimators=50, learning_rate=1.0)\n",
    "                    elif 'Logistic' in model_name:\n",
    "                        model_fold.set_params(C=1.0, max_iter=1000)  # C is regularization for LogisticRegression\n",
    "                    elif 'MLP' in model_name or 'Neural' in model_name:\n",
    "                        model_fold.set_params(alpha=0.01, max_iter=1000)  # alpha is regularization for MLPClassifier\n",
    "                    \n",
    "                    model_fold.fit(X_fold_train_scaled, y_fold_train)\n",
    "                \n",
    "                # Simple accuracy evaluation (no backtesting in CV)\n",
    "                predictions = model_fold.predict(X_fold_test_scaled)\n",
    "                accuracy = np.mean(predictions == y_fold_test)\n",
    "                cv_accuracies.append(accuracy)\n",
    "                completed_folds += 1\n",
    "                \n",
    "                print(f\"      ✔ Fold {fold + 1}: {scorer_name} accuracy {accuracy:.3f}\")\n",
    "                \n",
    "            except Exception as e:\n",
    "                print(f\"      ❌ Fold {fold + 1} failed: {str(e)[:50]}...\")\n",
    "                continue\n",
    "        \n",
    "        # Calculate final statistics\n",
    "        if len(cv_accuracies) > 0:\n",
    "            result = {\n",
    "                'cv_accuracy_mean': np.mean(cv_accuracies),\n",
    "                'cv_accuracy_std': np.std(cv_accuracies) if len(cv_accuracies) > 1 else 0,\n",
    "                'cv_folds_completed': completed_folds\n",
    "            }\n",
    "            print(f\"    📊 {scorer_name} CV Results: Accuracy {result['cv_accuracy_mean']:.3f}±{result['cv_accuracy_std']:.3f}\")\n",
    "            return result\n",
    "        else:\n",
    "            print(f\"    ❌ All {scorer_name} CV folds failed\")\n",
    "            return {\n",
    "                'cv_accuracy_mean': 0.5,\n",
    "                'cv_accuracy_std': 0,\n",
    "                'cv_folds_completed': 0\n",
    "            }\n",
    "            \n",
    "    except Exception as e:\n",
    "        print(f\"    ❌ {scorer_name} CV completely failed: {str(e)[:50]}...\")\n",
    "        return {\n",
    "            'cv_accuracy_mean': 0.5,\n",
    "            'cv_accuracy_std': 0,\n",
    "            'cv_folds_completed': 0\n",
    "        }\n",
    "\n",
    "def calculate_stability(model, X_scaled, y_true, n_bootstrap=50):\n",
    "    \"\"\"Calculate prediction stability using bootstrap sampling\"\"\"\n",
    "    predictions_list = []\n",
    "    \n",
    "    for i in range(n_bootstrap):\n",
    "        # Bootstrap sampling\n",
    "        n_samples = len(X_scaled)\n",
    "        bootstrap_indices = np.random.choice(n_samples, size=n_samples, replace=True)\n",
    "        X_bootstrap = X_scaled[bootstrap_indices]\n",
    "        \n",
    "        # Get predictions\n",
    "        if hasattr(model, 'predict_proba'):\n",
    "            pred_proba = model.predict_proba(X_bootstrap)[:, 1]\n",
    "            predictions = (pred_proba > 0.5).astype(int)\n",
    "        else:\n",
    "            predictions = model.predict(X_bootstrap)\n",
    "        \n",
    "        predictions_list.append(predictions)\n",
    "    \n",
    "    # Calculate stability as inverse of standard deviation of predictions\n",
    "    predictions_array = np.array(predictions_list)\n",
    "    prediction_variance = np.var(predictions_array, axis=0)\n",
    "    stability = 1 / (1 + np.mean(prediction_variance))\n",
    "    \n",
    "    return stability\n",
    "\n",
    "# ========== ENHANCED BACKTESTING WITH DETAILED TRADE ANALYSIS ==========\n",
    "\n",
    "#DYNAMIC TRADING COSTS IMPLEMENTED#\n",
    "\n",
    "# ========== CORRECTED BACKTESTING FUNCTION ==========\n",
    "\n",
    "def detailed_backtest_with_trade_analysis(model, X_scaled, open_prices, close_prices,\n",
    "                                         currency_pair, base_threshold=0.55, initial_capital=10000):\n",
    "    \"\"\"Enhanced backtesting with CORRECTED Sharpe/Sortino calculations\"\"\"\n",
    "    \n",
    "    # Currency-specific transaction costs (in pips)\n",
    "    transaction_costs_pips = {\n",
    "        'EUR_USD': 1.2,  # Major pair - tight spread\n",
    "        'JPY_USD': 1.5,  # Major pair\n",
    "        'AUD_USD': 2.0,  # Major pair but wider\n",
    "        'CHF_USD': 2.5,  # Less liquid major\n",
    "        'MXN_USD': 8.0,  # Emerging market - wide spread\n",
    "        'ZAR_USD': 8.0,\n",
    "        'TRY_USD': 3.0,\n",
    "        'CNY_USD': 3.0\n",
    "    }\n",
    "    \n",
    "    spread_pips = transaction_costs_pips.get(currency_pair, 3.0)  # Default 3 pips\n",
    "    \n",
    "    # Currency-specific pip values based on typical price levels\n",
    "    currency_pip_config = {\n",
    "        'EUR_USD': 0.0001,   # ~1.10 price level\n",
    "        'AUD_USD': 0.0001,   # ~0.70 price level\n",
    "        'CHF_USD': 0.0001,   # ~1.00 price level\n",
    "        'JPY_USD': 0.00001,  # ~0.009 price level - much smaller pip!\n",
    "        'MXN_USD': 0.00005,  # ~0.06 price level - smaller pip!\n",
    "        'ZAR_USD': 0.00005,\n",
    "        'TRY_USD': 0.0001,\n",
    "        'CNY_USD': 0.0001\n",
    "    }\n",
    "    \n",
    "    pip_value = currency_pip_config.get(currency_pair, 0.0001)\n",
    "    \n",
    "    # Get predictions\n",
    "    if hasattr(model, 'predict_proba'):\n",
    "        probabilities = model.predict_proba(X_scaled)[:, 1]\n",
    "    else:\n",
    "        if hasattr(model, 'decision_function'):\n",
    "            scores = model.decision_function(X_scaled)\n",
    "            probabilities = 1 / (1 + np.exp(-scores))\n",
    "        else:\n",
    "            predictions = model.predict(X_scaled)\n",
    "            probabilities = predictions\n",
    "    \n",
    "    # Enhanced tracking\n",
    "    portfolio_value = [initial_capital]\n",
    "    position = 0\n",
    "    trade_log = []\n",
    "    daily_returns = []\n",
    "    position_changes = []\n",
    "    signal_strength = []\n",
    "    \n",
    "    # Track dynamic transaction costs\n",
    "    transaction_costs_log = []\n",
    "    \n",
    "    for i in range(len(probabilities)):\n",
    "        if i + 1 >= len(close_prices):\n",
    "            break\n",
    "            \n",
    "        prob = probabilities[i]\n",
    "        signal_strength.append(abs(prob - 0.5))  # Track signal strength\n",
    "        \n",
    "        # Enhanced position logic\n",
    "        if prob > base_threshold:\n",
    "            desired_position = 1  # Long\n",
    "        elif prob < (1 - base_threshold):\n",
    "            desired_position = -1  # Short\n",
    "        else:\n",
    "            desired_position = 0  # No position\n",
    "        \n",
    "        # Calculate DYNAMIC transaction cost based on CURRENT price\n",
    "        current_price = open_prices.iloc[i]\n",
    "        transaction_cost_pct = (spread_pips * pip_value) / current_price\n",
    "        \n",
    "        # Log the dynamic cost calculation (only for trades)\n",
    "        if desired_position != position:\n",
    "            transaction_costs_log.append({\n",
    "                'day': i,\n",
    "                'price': current_price,\n",
    "                'cost_pct': transaction_cost_pct * 100,\n",
    "                'spread_pips': spread_pips,\n",
    "                'pip_value': pip_value\n",
    "            })\n",
    "            \n",
    "            # Print dynamic cost calculation for first few trades\n",
    "            if len(transaction_costs_log) <= 2:\n",
    "                print(f\"    💰 {currency_pair}: {spread_pips} pips × {pip_value} pip_value = {(transaction_cost_pct*100):.4f}% cost\")\n",
    "        \n",
    "        # Track position changes\n",
    "        position_change = 0\n",
    "        if desired_position != position:\n",
    "            if position != 0:  # Closing existing position\n",
    "                portfolio_value[-1] *= (1 - transaction_cost_pct)\n",
    "                position_change += 1\n",
    "                \n",
    "            if desired_position != 0:  # Opening new position\n",
    "                portfolio_value[-1] *= (1 - transaction_cost_pct)\n",
    "                position_change += 1\n",
    "                \n",
    "            # Log the trade\n",
    "            trade_log.append({\n",
    "                'day': i,\n",
    "                'from_position': position,\n",
    "                'to_position': desired_position,\n",
    "                'signal_strength': signal_strength[-1],\n",
    "                'transaction_cost': transaction_cost_pct,\n",
    "                'price': current_price\n",
    "            })\n",
    "            \n",
    "            position = desired_position\n",
    "            \n",
    "        position_changes.append(position_change)\n",
    "        \n",
    "        # Calculate return\n",
    "        if position != 0:\n",
    "            trade_return = (close_prices.iloc[i + 1] - open_prices.iloc[i]) / open_prices.iloc[i]\n",
    "            daily_return = position * trade_return\n",
    "        else:\n",
    "            daily_return = 0\n",
    "            \n",
    "        portfolio_value.append(portfolio_value[-1] * (1 + daily_return))\n",
    "        daily_returns.append(daily_return)\n",
    "    \n",
    "    returns_series = pd.Series(daily_returns)\n",
    "    signal_strength_series = pd.Series(signal_strength)\n",
    "    \n",
    "    # Calculate detailed metrics\n",
    "    total_trades = len(trade_log)\n",
    "    \n",
    "    # Calculate average transaction cost from the log\n",
    "    if transaction_costs_log:\n",
    "        avg_transaction_cost_pct = np.mean([t['cost_pct'] for t in transaction_costs_log]) / 100\n",
    "    else:\n",
    "        avg_transaction_cost_pct = 0\n",
    "    \n",
    "    total_transaction_costs = sum([t['transaction_cost'] * portfolio_value[0] for t in trade_log])\n",
    "    \n",
    "    # CORRECTED SHARPE AND SORTINO CALCULATIONS\n",
    "    if len(returns_series) > 0:\n",
    "        # Risk-free rate\n",
    "        rf_annual = 0.04  # 4% annual\n",
    "        rf_daily = rf_annual / 252\n",
    "        \n",
    "        # Excess returns (for both Sharpe and Sortino)\n",
    "        excess_returns = returns_series - rf_daily\n",
    "        \n",
    "        # CORRECTED Sharpe Ratio (now includes risk-free rate)\n",
    "        if returns_series.std() > 0:\n",
    "            sharpe = np.sqrt(252) * excess_returns.mean() / returns_series.std()\n",
    "        else:\n",
    "            sharpe = 0\n",
    "        \n",
    "        # CORRECTED Sortino Ratio (using proper downside deviation)\n",
    "        downside_returns = excess_returns[excess_returns < 0]\n",
    "        \n",
    "        if len(downside_returns) > 0:\n",
    "            # Use standard deviation of downside returns (not RMS)\n",
    "            downside_std = downside_returns.std()\n",
    "            \n",
    "            if downside_std > 0:\n",
    "                sortino = np.sqrt(252) * excess_returns.mean() / downside_std\n",
    "            else:\n",
    "                sortino = 0\n",
    "        else:\n",
    "            # No downside returns - very good!\n",
    "            sortino = 100  # Cap at 100 instead of infinity\n",
    "        \n",
    "        # Other metrics remain the same\n",
    "        cum_returns = (1 + returns_series).cumprod()\n",
    "        running_max = cum_returns.expanding().max()\n",
    "        drawdown = (cum_returns - running_max) / running_max\n",
    "        max_drawdown = drawdown.min() if len(drawdown) > 0 else 0\n",
    "        \n",
    "        var_95 = returns_series.quantile(0.05)\n",
    "        cvar = returns_series[returns_series <= var_95].mean() if len(returns_series[returns_series <= var_95]) > 0 else 0\n",
    "        \n",
    "        trade_frequency = total_trades / len(probabilities) * 252\n",
    "        avg_signal_strength = signal_strength_series.mean()\n",
    "        signal_decay = signal_strength_series.iloc[:len(signal_strength_series)//2].mean() - signal_strength_series.iloc[len(signal_strength_series)//2:].mean()\n",
    "    else:\n",
    "        sharpe = sortino = max_drawdown = cvar = trade_frequency = avg_signal_strength = signal_decay = 0\n",
    "    \n",
    "    return {\n",
    "        'final_value': portfolio_value[-1],\n",
    "        'total_return': (portfolio_value[-1] / initial_capital - 1) * 100,\n",
    "        'trades': total_trades,\n",
    "        'trade_frequency': trade_frequency,\n",
    "        'sharpe': sharpe,\n",
    "        'sortino': sortino,\n",
    "        'max_drawdown': max_drawdown,\n",
    "        'cvar_95': cvar,\n",
    "        'avg_signal_strength': avg_signal_strength,\n",
    "        'signal_decay': signal_decay,\n",
    "        'transaction_cost_pct': avg_transaction_cost_pct,\n",
    "        'total_transaction_costs': total_transaction_costs,\n",
    "        'spread_pips': spread_pips,\n",
    "        'trade_log': trade_log,\n",
    "        'transaction_costs_log': transaction_costs_log\n",
    "    }\n",
    "\n",
    "# ========== MODEL TRAINING FUNCTION ==========\n",
    "def get_hyperparameter_grids():\n",
    "    \"\"\"Hyperparameter grids for all models\"\"\"\n",
    "    return {\n",
    "        'Logistic': {\n",
    "            'C': [0.001, 0.01, 0.1, 1.0, 10.0],\n",
    "            'penalty': ['l1', 'l2'],\n",
    "            'solver': ['liblinear'],\n",
    "            'max_iter': [1000]\n",
    "        },\n",
    "        'DecisionTree': {\n",
    "            'max_depth': [3, 5, 10, None],\n",
    "            'min_samples_split': [5, 10, 20],\n",
    "            'min_samples_leaf': [5, 10]\n",
    "        },\n",
    "        'RandomForest': {\n",
    "            'n_estimators': [50, 100, 200],\n",
    "            'max_depth': [5, 10, None],\n",
    "            'min_samples_split': [5, 10],\n",
    "            'max_features': ['sqrt', None]\n",
    "        },\n",
    "        'GradientBoosting': {\n",
    "            'n_estimators': [50, 100],\n",
    "            'learning_rate': [0.01, 0.1],\n",
    "            'max_depth': [3, 5],\n",
    "            'subsample': [0.8, 1.0]\n",
    "        },\n",
    "        'Neural': {\n",
    "            'hidden_layer_sizes': [(50,), (100,), (100, 50)],\n",
    "            'activation': ['tanh', 'relu'],\n",
    "            'alpha': [0.0001, 0.001],\n",
    "            'max_iter': [1000]\n",
    "        },\n",
    "        'AdaBoost': {\n",
    "            'n_estimators': [50, 100],\n",
    "            'learning_rate': [0.5, 1.0]\n",
    "        },\n",
    "        'XGBoost': {\n",
    "            'n_estimators': [50, 100],\n",
    "            'learning_rate': [0.01, 0.1],\n",
    "            'max_depth': [3, 5],\n",
    "            'subsample': [0.8, 1.0]\n",
    "        }\n",
    "    }\n",
    "\n",
    "def train_model_with_optimization(X_train, y_train, model_name, model_class,\n",
    "                                param_grid, scorer, cv_folds=5, n_iter=10,\n",
    "                                returns_magnitude=None, use_madl_weights=False):\n",
    "    \"\"\"Train model with hyperparameter optimization using 5-fold time series CV\"\"\"\n",
    "    print(f\"    Optimizing {model_name} with {cv_folds}-fold time series CV...\")\n",
    "    \n",
    "    # MADL is ONLY supported for Logistic Regression\n",
    "    if use_madl_weights and model_name != 'Logistic':\n",
    "        print(f\"    ⚠️ MADL not supported for {model_name}, using standard optimization\")\n",
    "        use_madl_weights = False\n",
    "    \n",
    "    print(f\"    MADL optimization enabled: {use_madl_weights}\")\n",
    "    \n",
    "    tscv = TimeSeriesSplit(n_splits=cv_folds)\n",
    "    \n",
    "    # Special handling for Logistic Regression with true MADL implementation\n",
    "    if model_name == 'Logistic' and use_madl_weights:\n",
    "        try:\n",
    "            print(f\"    🚀 Using TRUE MADL implementation for Logistic Regression\")\n",
    "            \n",
    "            # Create custom MADL Logistic Regression with fixed implementation\n",
    "            best_model = MADLLogisticRegression(\n",
    "                C=1.0,\n",
    "                max_iter=500,  # Reduced iterations\n",
    "                random_state=42,\n",
    "                learning_rate=0.1\n",
    "            )\n",
    "            \n",
    "            # Fit with returns magnitude\n",
    "            best_model.fit(X_train, y_train, returns_magnitude=returns_magnitude)\n",
    "            \n",
    "            print(f\"    ✓ Logistic Regression trained with TRUE MADL objective\")\n",
    "            return best_model, {'custom_objective': 'MADL'}, 0.0\n",
    "            \n",
    "        except Exception as e:\n",
    "            print(f\"    ❌ Error in MADL Logistic: {str(e)}\")\n",
    "            import traceback\n",
    "            traceback.print_exc()\n",
    "            print(f\"    Falling back to standard logistic regression\")\n",
    "    \n",
    "    # Regular hyperparameter optimization for other models or fallback\n",
    "    try:\n",
    "        search = RandomizedSearchCV(\n",
    "            estimator=model_class(random_state=42),\n",
    "            param_distributions=param_grid,\n",
    "            n_iter=n_iter,\n",
    "            cv=tscv,\n",
    "            scoring=scorer,\n",
    "            n_jobs=1,\n",
    "            random_state=42,\n",
    "            verbose=0\n",
    "        )\n",
    "        \n",
    "        search.fit(X_train, y_train)\n",
    "        \n",
    "        return search.best_estimator_, search.best_params_, search.best_score_\n",
    "        \n",
    "    except Exception as e:\n",
    "        print(f\"    ❌ Hyperparameter optimization failed: {str(e)}\")\n",
    "        # Fallback to default parameters\n",
    "        default_model = model_class(random_state=42)\n",
    "        default_model.fit(X_train, y_train)\n",
    "        return default_model, {}, 0.0\n",
    "\n",
    "print(\"🚀 All functions loaded successfully! Ready to run the trading system.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7ccf8b59-5b12-41ed-b4b6-553ec3e37b21",
   "metadata": {},
   "outputs": [],
   "source": [
    "# ========== TEST PERIOD CALCULATION ==========\n",
    "def calculate_test_period(train_start, train_end):\n",
    "    \"\"\"Calculate test period dates\"\"\"\n",
    "    start_dt = datetime.strptime(train_start, '%Y-%m-%d')\n",
    "    end_dt = datetime.strptime(train_end, '%Y-%m-%d')\n",
    "    \n",
    "    total_days = (end_dt - start_dt).days\n",
    "    test_length = int(total_days * 0.25)\n",
    "    \n",
    "    test_start = end_dt + timedelta(days=1)\n",
    "    test_end = test_start + timedelta(days=test_length)\n",
    "    \n",
    "    return test_start.strftime('%Y-%m-%d'), test_end.strftime('%Y-%m-%d')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8f1aeb47-9552-4319-a094-baf120a1a00b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bb3094e6-1738-4f4d-a5ed-078966dfd7fe",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "88057015-8b03-4490-b5a1-1e4d9161137e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "🚀 Starting comprehensive ML trading system analysis...\n",
      "================================================================================\n",
      "\n",
      "📍 PERIOD 1: Training 2018-01-01 to 2020-03-10\n",
      "------------------------------------------------------------\n",
      "\n",
      "💱 Processing EUR_USD...\n",
      "    ✅ EUR_USD: Total=568 days, Train=426 days, Test=142 days\n",
      "       📅 Train: 2018-01-01 to 2019-08-21\n",
      "       📅 Test:  2019-08-22 to 2020-03-10\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 550 rows\n",
      "    ✔ Loaded 13w_tbill: 550 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=424, test=140\n",
      "  📈 Buy-and-hold benchmark: Train=-7.67%, Test=1.77%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.886\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.760±0.069\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0098% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ Logistic_Standard: Test Return=3.79%, Trades=6\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0143]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 1.6484\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0841\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5457, Standard intercept: 0.5000\n",
      "       MADL coef norm: 1.3417, Standard coef norm: 1.7402\n",
      "       Coefficient difference norm: 0.3985\n",
      "      ✔ Fold 1: MADL accuracy 0.686\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0037\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.3054\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0658\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0365, Standard intercept: -0.0204\n",
      "       MADL coef norm: 1.2274, Standard coef norm: 1.5966\n",
      "       Coefficient difference norm: 0.3693\n",
      "      ✔ Fold 2: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0037\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.3768\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0697\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1084, Standard intercept: -0.0602\n",
      "       MADL coef norm: 1.3036, Standard coef norm: 1.7019\n",
      "       Coefficient difference norm: 0.3986\n",
      "      ✔ Fold 3: MADL accuracy 0.686\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0036\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.2175\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0615\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0811, Standard intercept: -0.0750\n",
      "       MADL coef norm: 1.1941, Standard coef norm: 1.5542\n",
      "       Coefficient difference norm: 0.3601\n",
      "      ✔ Fold 4: MADL accuracy 0.857\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0033\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.3784\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0700\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1527, Standard intercept: -0.1288\n",
      "       MADL coef norm: 1.2239, Standard coef norm: 1.5875\n",
      "       Coefficient difference norm: 0.3638\n",
      "      ✔ Fold 5: MADL accuracy 0.714\n",
      "    📊 MADL CV Results: Accuracy 0.737±0.064\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.3875\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0703\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1391, Standard intercept: -0.1848\n",
      "       MADL coef norm: 1.2482, Standard coef norm: 1.6214\n",
      "       Coefficient difference norm: 0.3732\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ Logistic_MADL: Test Return=39.69%, Trades=78\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.543\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.640±0.062\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=25.15%, Trades=75\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.829\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.731±0.056\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ RandomForest_Standard: Test Return=35.82%, Trades=72\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.657\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.691±0.021\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=34.66%, Trades=79\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.829\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.749±0.049\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ Neural_Standard: Test Return=37.08%, Trades=81\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.691±0.033\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0098% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=5.56%, Trades=12\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.657\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.703±0.029\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ XGBoost_Standard: Test Return=32.40%, Trades=78\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=423, test=140\n",
      "  📈 Buy-and-hold benchmark: Train=-7.67%, Test=1.77%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.657\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.714±0.048\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ Logistic_Standard: Test Return=32.43%, Trades=86\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0143]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.7453\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0891\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5066, Standard intercept: 0.4904\n",
      "       MADL coef norm: 1.3839, Standard coef norm: 1.7967\n",
      "       Coefficient difference norm: 0.4133\n",
      "      ✔ Fold 1: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0037\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.5247\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0770\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0933, Standard intercept: -0.0802\n",
      "       MADL coef norm: 1.3075, Standard coef norm: 1.7001\n",
      "       Coefficient difference norm: 0.3932\n",
      "      ✔ Fold 2: MADL accuracy 0.686\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0037\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.6134\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0816\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0748, Standard intercept: -0.0914\n",
      "       MADL coef norm: 1.3383, Standard coef norm: 1.7409\n",
      "       Coefficient difference norm: 0.4037\n",
      "      ✔ Fold 3: MADL accuracy 0.657\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0036\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.3413\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0680\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0734, Standard intercept: -0.1014\n",
      "       MADL coef norm: 1.2233, Standard coef norm: 1.5910\n",
      "       Coefficient difference norm: 0.3684\n",
      "      ✔ Fold 4: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0033\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.4864\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0753\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1061, Standard intercept: -0.1318\n",
      "       MADL coef norm: 1.2690, Standard coef norm: 1.6460\n",
      "       Coefficient difference norm: 0.3773\n",
      "      ✔ Fold 5: MADL accuracy 0.686\n",
      "    📊 MADL CV Results: Accuracy 0.714±0.051\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.4840\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0753\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1832, Standard intercept: -0.1995\n",
      "       MADL coef norm: 1.2716, Standard coef norm: 1.6506\n",
      "       Coefficient difference norm: 0.3795\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ Logistic_MADL: Test Return=32.60%, Trades=86\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.571\n",
      "      ✔ Fold 2: Accuracy accuracy 0.571\n",
      "      ✔ Fold 3: Accuracy accuracy 0.429\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.594±0.101\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=30.22%, Trades=90\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.457\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.829\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.680±0.124\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ RandomForest_Standard: Test Return=32.95%, Trades=75\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.286\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.629\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.617±0.171\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=30.49%, Trades=84\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.314\n",
      "      ✔ Fold 2: Accuracy accuracy 0.571\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.629\n",
      "    📊 Accuracy CV Results: Accuracy 0.571±0.141\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ Neural_Standard: Test Return=32.03%, Trades=84\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.286\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.600\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.629\n",
      "    📊 Accuracy CV Results: Accuracy 0.566±0.142\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0098% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=9.44%, Trades=18\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.657\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.680±0.049\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    ✅ XGBoost_Standard: Test Return=30.12%, Trades=67\n",
      "\n",
      "💱 Processing JPY_USD...\n",
      "    ✅ JPY_USD: Total=572 days, Train=429 days, Test=143 days\n",
      "       📅 Train: 2018-01-01 to 2019-08-22\n",
      "       📅 Test:  2019-08-23 to 2020-03-10\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 550 rows\n",
      "    ✔ Loaded 13w_tbill: 550 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=427, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=5.99%, Test=1.10%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.857\n",
      "      ✔ Fold 4: Accuracy accuracy 0.829\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.777±0.066\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1672% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1632% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1629% cost\n",
      "    ✅ Logistic_Standard: Test Return=10.33%, Trades=11\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0029\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0016, Total Loss = 1.6089\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0822\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.6035, Standard intercept: 0.5578\n",
      "       MADL coef norm: 1.3516, Standard coef norm: 1.7565\n",
      "       Coefficient difference norm: 0.4050\n",
      "      ✔ Fold 1: MADL accuracy 0.829\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0034\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.7723\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0898\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0153, Standard intercept: 0.0007\n",
      "       MADL coef norm: 1.4416, Standard coef norm: 1.8767\n",
      "       Coefficient difference norm: 0.4351\n",
      "      ✔ Fold 2: MADL accuracy 0.714\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.2618\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0641\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0598, Standard intercept: 0.1079\n",
      "       MADL coef norm: 1.2565, Standard coef norm: 1.6416\n",
      "       Coefficient difference norm: 0.3853\n",
      "      ✔ Fold 3: MADL accuracy 0.857\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.7777\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0904\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2080, Standard intercept: 0.2141\n",
      "       MADL coef norm: 1.4350, Standard coef norm: 1.8666\n",
      "       Coefficient difference norm: 0.4317\n",
      "      ✔ Fold 4: MADL accuracy 0.857\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.9374\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0986\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2058, Standard intercept: 0.2297\n",
      "       MADL coef norm: 1.4640, Standard coef norm: 1.9006\n",
      "       Coefficient difference norm: 0.4367\n",
      "      ✔ Fold 5: MADL accuracy 0.686\n",
      "    📊 MADL CV Results: Accuracy 0.789±0.074\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0139]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.8955\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0968\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2055, Standard intercept: 0.1598\n",
      "       MADL coef norm: 1.4716, Standard coef norm: 1.9131\n",
      "       Coefficient difference norm: 0.4415\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ Logistic_MADL: Test Return=31.12%, Trades=72\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.714±0.036\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=21.98%, Trades=64\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.886\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.760±0.069\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ RandomForest_Standard: Test Return=26.56%, Trades=66\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.743±0.051\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=28.47%, Trades=67\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.731±0.050\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ Neural_Standard: Test Return=25.95%, Trades=70\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.674±0.056\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1672% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1596% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1605% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=12.92%, Trades=27\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.857\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.731±0.074\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ XGBoost_Standard: Test Return=26.11%, Trades=68\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=426, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=5.99%, Test=1.10%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.629\n",
      "      ✔ Fold 3: Accuracy accuracy 0.886\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.760±0.086\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1697% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ Logistic_Standard: Test Return=29.74%, Trades=55\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0029\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0020, Total Loss = 2.0471\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1048\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5671, Standard intercept: 0.5508\n",
      "       MADL coef norm: 1.5058, Standard coef norm: 1.9558\n",
      "       Coefficient difference norm: 0.4503\n",
      "      ✔ Fold 1: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0034\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 2.2032\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1117\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0339, Standard intercept: 0.0471\n",
      "       MADL coef norm: 1.5982, Standard coef norm: 2.0807\n",
      "       Coefficient difference norm: 0.4831\n",
      "      ✔ Fold 2: MADL accuracy 0.629\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0033\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.4198\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0722\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1462, Standard intercept: 0.1296\n",
      "       MADL coef norm: 1.3085, Standard coef norm: 1.7093\n",
      "       Coefficient difference norm: 0.4019\n",
      "      ✔ Fold 3: MADL accuracy 0.857\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.8477\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0943\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2333, Standard intercept: 0.2052\n",
      "       MADL coef norm: 1.4392, Standard coef norm: 1.8712\n",
      "       Coefficient difference norm: 0.4327\n",
      "      ✔ Fold 4: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.9788\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1011\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2580, Standard intercept: 0.2323\n",
      "       MADL coef norm: 1.4730, Standard coef norm: 1.9115\n",
      "       Coefficient difference norm: 0.4388\n",
      "      ✔ Fold 5: MADL accuracy 0.686\n",
      "    📊 MADL CV Results: Accuracy 0.737±0.078\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0139]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 2.0034\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1022\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1824, Standard intercept: 0.1661\n",
      "       MADL coef norm: 1.4988, Standard coef norm: 1.9479\n",
      "       Coefficient difference norm: 0.4495\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1697% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ Logistic_MADL: Test Return=29.19%, Trades=57\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.629\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.674±0.029\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1696% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=24.41%, Trades=64\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.743\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.714±0.026\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1696% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ RandomForest_Standard: Test Return=24.17%, Trades=69\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.743\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.042\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1696% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=28.73%, Trades=61\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.457\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.674±0.123\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1697% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ Neural_Standard: Test Return=30.08%, Trades=58\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.629\n",
      "      ✔ Fold 3: Accuracy accuracy 0.629\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.600\n",
      "    📊 Accuracy CV Results: Accuracy 0.634±0.042\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1696% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1596% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1605% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-0.90%, Trades=22\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.629\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.680±0.042\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1696% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1581% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1592% cost\n",
      "    ✅ XGBoost_Standard: Test Return=28.58%, Trades=56\n",
      "\n",
      "💱 Processing AUD_USD...\n",
      "    ✅ AUD_USD: Total=571 days, Train=428 days, Test=143 days\n",
      "       📅 Train: 2018-01-01 to 2019-08-22\n",
      "       📅 Test:  2019-08-23 to 2020-03-10\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 550 rows\n",
      "    ✔ Loaded 13w_tbill: 550 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=426, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-13.39%, Test=-3.74%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.749±0.049\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ Logistic_Standard: Test Return=52.92%, Trades=75\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0147]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.1883\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0606\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1285, Standard intercept: 0.0828\n",
      "       MADL coef norm: 1.1677, Standard coef norm: 1.5185\n",
      "       Coefficient difference norm: 0.3508\n",
      "      ✔ Fold 1: MADL accuracy 0.657\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0147]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0041\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.3633\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0691\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2930, Standard intercept: -0.2770\n",
      "       MADL coef norm: 1.2433, Standard coef norm: 1.6159\n",
      "       Coefficient difference norm: 0.3726\n",
      "      ✔ Fold 2: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0147]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.1885\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0598\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3054, Standard intercept: -0.2572\n",
      "       MADL coef norm: 1.2315, Standard coef norm: 1.6103\n",
      "       Coefficient difference norm: 0.3791\n",
      "      ✔ Fold 3: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0189]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.5282\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0773\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1654, Standard intercept: -0.1593\n",
      "       MADL coef norm: 1.3348, Standard coef norm: 1.7369\n",
      "       Coefficient difference norm: 0.4021\n",
      "      ✔ Fold 4: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0189]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0041\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5084\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0763\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1587, Standard intercept: -0.1347\n",
      "       MADL coef norm: 1.2964, Standard coef norm: 1.6837\n",
      "       Coefficient difference norm: 0.3875\n",
      "      ✔ Fold 5: MADL accuracy 0.743\n",
      "    📊 MADL CV Results: Accuracy 0.737±0.042\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0189]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0032\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.5009\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0762\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1130, Standard intercept: -0.1587\n",
      "       MADL coef norm: 1.3084, Standard coef norm: 1.7008\n",
      "       Coefficient difference norm: 0.3925\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ Logistic_MADL: Test Return=52.56%, Trades=75\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.714±0.054\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=32.32%, Trades=84\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.703±0.071\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ RandomForest_Standard: Test Return=36.78%, Trades=78\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.703±0.064\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=34.28%, Trades=80\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.829\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.743±0.063\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ Neural_Standard: Test Return=54.47%, Trades=65\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.914\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.737±0.100\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0250% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0250% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=12.22%, Trades=29\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.703±0.046\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ XGBoost_Standard: Test Return=36.34%, Trades=86\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=425, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-13.39%, Test=-3.74%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.743\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.749±0.042\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ Logistic_Standard: Test Return=43.42%, Trades=93\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0147]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.4808\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0743\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1054, Standard intercept: 0.0892\n",
      "       MADL coef norm: 1.3002, Standard coef norm: 1.6917\n",
      "       Coefficient difference norm: 0.3920\n",
      "      ✔ Fold 1: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0147]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 1.7654\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0895\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3061, Standard intercept: -0.2929\n",
      "       MADL coef norm: 1.4000, Standard coef norm: 1.8191\n",
      "       Coefficient difference norm: 0.4197\n",
      "      ✔ Fold 2: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0147]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 1.4794\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0746\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2836, Standard intercept: -0.3003\n",
      "       MADL coef norm: 1.3033, Standard coef norm: 1.6985\n",
      "       Coefficient difference norm: 0.3963\n",
      "      ✔ Fold 3: MADL accuracy 0.829\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0189]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0043\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.6395\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0834\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1236, Standard intercept: -0.1516\n",
      "       MADL coef norm: 1.3580, Standard coef norm: 1.7663\n",
      "       Coefficient difference norm: 0.4090\n",
      "      ✔ Fold 4: MADL accuracy 0.714\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0189]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0041\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5510\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0789\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1074, Standard intercept: -0.1331\n",
      "       MADL coef norm: 1.3097, Standard coef norm: 1.7007\n",
      "       Coefficient difference norm: 0.3912\n",
      "      ✔ Fold 5: MADL accuracy 0.743\n",
      "    📊 MADL CV Results: Accuracy 0.754±0.039\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0189]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0032\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5414\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0782\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1545, Standard intercept: -0.1708\n",
      "       MADL coef norm: 1.3156, Standard coef norm: 1.7104\n",
      "       Coefficient difference norm: 0.3952\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ Logistic_MADL: Test Return=53.20%, Trades=78\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.629\n",
      "      ✔ Fold 3: Accuracy accuracy 0.600\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.629±0.018\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=31.48%, Trades=76\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.038\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ RandomForest_Standard: Test Return=42.61%, Trades=69\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.543\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.571\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.646±0.076\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=41.69%, Trades=84\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.600\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.055\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0296% cost\n",
      "    ✅ Neural_Standard: Test Return=18.83%, Trades=72\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.543\n",
      "      ✔ Fold 2: Accuracy accuracy 0.629\n",
      "      ✔ Fold 3: Accuracy accuracy 0.457\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.600±0.089\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0250% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0250% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=13.01%, Trades=27\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.829\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.737±0.052\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0295% cost\n",
      "    ✅ XGBoost_Standard: Test Return=41.70%, Trades=84\n",
      "\n",
      "💱 Processing CHF_USD...\n",
      "    ✅ CHF_USD: Total=571 days, Train=428 days, Test=143 days\n",
      "       📅 Train: 2018-01-01 to 2019-08-22\n",
      "       📅 Test:  2019-08-23 to 2020-03-10\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 550 rows\n",
      "    ✔ Loaded 13w_tbill: 550 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=426, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-0.96%, Test=4.57%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.737±0.046\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0248% cost\n",
      "    ✅ Logistic_Standard: Test Return=43.14%, Trades=87\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0023, Total Loss = 1.3080\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0668\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2681, Standard intercept: 0.2225\n",
      "       MADL coef norm: 1.2009, Standard coef norm: 1.5583\n",
      "       Coefficient difference norm: 0.3574\n",
      "      ✔ Fold 1: MADL accuracy 0.686\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0034\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.5270\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0773\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0774, Standard intercept: -0.0614\n",
      "       MADL coef norm: 1.3309, Standard coef norm: 1.7316\n",
      "       Coefficient difference norm: 0.4008\n",
      "      ✔ Fold 2: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.6439\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0834\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1438, Standard intercept: -0.0956\n",
      "       MADL coef norm: 1.4217, Standard coef norm: 1.8555\n",
      "       Coefficient difference norm: 0.4341\n",
      "      ✔ Fold 3: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.2577\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0637\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1775, Standard intercept: -0.1713\n",
      "       MADL coef norm: 1.2183, Standard coef norm: 1.5863\n",
      "       Coefficient difference norm: 0.3680\n",
      "      ✔ Fold 4: MADL accuracy 0.686\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0024\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.3448\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0682\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1432, Standard intercept: -0.1192\n",
      "       MADL coef norm: 1.2260, Standard coef norm: 1.5926\n",
      "       Coefficient difference norm: 0.3668\n",
      "      ✔ Fold 5: MADL accuracy 0.771\n",
      "    📊 MADL CV Results: Accuracy 0.731±0.039\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.4915\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0758\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1017, Standard intercept: -0.1474\n",
      "       MADL coef norm: 1.2959, Standard coef norm: 1.6835\n",
      "       Coefficient difference norm: 0.3876\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0248% cost\n",
      "    ✅ Logistic_MADL: Test Return=42.73%, Trades=79\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.691±0.033\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=38.21%, Trades=83\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.691±0.071\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ RandomForest_Standard: Test Return=42.08%, Trades=79\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.691±0.071\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=36.67%, Trades=81\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.731±0.043\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0248% cost\n",
      "    ✅ Neural_Standard: Test Return=42.52%, Trades=70\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.857\n",
      "    📊 Accuracy CV Results: Accuracy 0.697±0.082\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=9.14%, Trades=21\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.629\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.886\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.100\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ XGBoost_Standard: Test Return=35.46%, Trades=85\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=425, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-0.96%, Test=4.57%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.571\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.697±0.069\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ Logistic_Standard: Test Return=41.62%, Trades=84\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0023, Total Loss = 1.9142\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0972\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3296, Standard intercept: 0.3134\n",
      "       MADL coef norm: 1.4318, Standard coef norm: 1.8564\n",
      "       Coefficient difference norm: 0.4250\n",
      "      ✔ Fold 1: MADL accuracy 0.514\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0034\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 1.8292\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0927\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0531, Standard intercept: -0.0399\n",
      "       MADL coef norm: 1.4347, Standard coef norm: 1.8655\n",
      "       Coefficient difference norm: 0.4313\n",
      "      ✔ Fold 2: MADL accuracy 0.686\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 1.9738\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1002\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0162, Standard intercept: -0.0329\n",
      "       MADL coef norm: 1.4983, Standard coef norm: 1.9506\n",
      "       Coefficient difference norm: 0.4533\n",
      "      ✔ Fold 3: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.4313\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0727\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1009, Standard intercept: -0.1289\n",
      "       MADL coef norm: 1.2678, Standard coef norm: 1.6492\n",
      "       Coefficient difference norm: 0.3821\n",
      "      ✔ Fold 4: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0024\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.4139\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0719\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1031, Standard intercept: -0.1288\n",
      "       MADL coef norm: 1.2538, Standard coef norm: 1.6286\n",
      "       Coefficient difference norm: 0.3751\n",
      "      ✔ Fold 5: MADL accuracy 0.743\n",
      "    📊 MADL CV Results: Accuracy 0.691±0.093\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.6684\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0849\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1267, Standard intercept: -0.1429\n",
      "       MADL coef norm: 1.3516, Standard coef norm: 1.7547\n",
      "       Coefficient difference norm: 0.4036\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0248% cost\n",
      "    ✅ Logistic_MADL: Test Return=36.86%, Trades=74\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.571\n",
      "      ✔ Fold 4: Accuracy accuracy 0.429\n",
      "      ✔ Fold 5: Accuracy accuracy 0.857\n",
      "    📊 Accuracy CV Results: Accuracy 0.634±0.140\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0248% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=36.04%, Trades=48\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.486\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.657±0.108\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ RandomForest_Standard: Test Return=29.84%, Trades=89\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.543\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.457\n",
      "      ✔ Fold 5: Accuracy accuracy 0.857\n",
      "    📊 Accuracy CV Results: Accuracy 0.651±0.139\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=10.08%, Trades=56\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.371\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.514\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.606±0.142\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0248% cost\n",
      "    ✅ Neural_Standard: Test Return=34.95%, Trades=75\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.314\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.629\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.571\n",
      "    📊 Accuracy CV Results: Accuracy 0.594±0.155\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=9.82%, Trades=19\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.857\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.098\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    ✅ XGBoost_Standard: Test Return=37.40%, Trades=77\n",
      "\n",
      "💱 Processing MXN_USD...\n",
      "    ✅ MXN_USD: Total=572 days, Train=429 days, Test=143 days\n",
      "       📅 Train: 2018-01-01 to 2019-08-22\n",
      "       📅 Test:  2019-08-23 to 2020-03-10\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 550 rows\n",
      "    ✔ Loaded 13w_tbill: 550 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=427, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-0.77%, Test=-4.53%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.749±0.033\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    ✅ Logistic_Standard: Test Return=-40.57%, Trades=94\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0188]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0052\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0041\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 1.2219\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0605\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 1.2217, Standard intercept: 1.1760\n",
      "       MADL coef norm: 1.1818, Standard coef norm: 1.5364\n",
      "       Coefficient difference norm: 0.3546\n",
      "      ✔ Fold 1: MADL accuracy 0.600\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0064\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0050\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0024, Total Loss = 1.4863\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0743\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4524, Standard intercept: 0.4685\n",
      "       MADL coef norm: 1.3130, Standard coef norm: 1.7083\n",
      "       Coefficient difference norm: 0.3954\n",
      "      ✔ Fold 2: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0063\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0047\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 1.0718\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0531\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2211, Standard intercept: 0.2692\n",
      "       MADL coef norm: 1.1848, Standard coef norm: 1.5511\n",
      "       Coefficient difference norm: 0.3665\n",
      "      ✔ Fold 3: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0061\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0048\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.3592\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0679\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2319, Standard intercept: 0.2380\n",
      "       MADL coef norm: 1.2563, Standard coef norm: 1.6344\n",
      "       Coefficient difference norm: 0.3781\n",
      "      ✔ Fold 4: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0058\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0046\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 1.3632\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0684\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2370, Standard intercept: 0.2610\n",
      "       MADL coef norm: 1.2393, Standard coef norm: 1.6104\n",
      "       Coefficient difference norm: 0.3714\n",
      "      ✔ Fold 5: MADL accuracy 0.771\n",
      "    📊 MADL CV Results: Accuracy 0.731±0.067\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0046\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 1.3390\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0676\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2512, Standard intercept: 0.2055\n",
      "       MADL coef norm: 1.2358, Standard coef norm: 1.6065\n",
      "       Coefficient difference norm: 0.3707\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    ✅ Logistic_MADL: Test Return=-39.98%, Trades=92\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.743\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.571\n",
      "    📊 Accuracy CV Results: Accuracy 0.686±0.070\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8048% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-37.29%, Trades=65\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.714±0.075\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-46.90%, Trades=90\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.714±0.060\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8048% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-42.95%, Trades=78\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.800\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.737±0.075\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    ✅ Neural_Standard: Test Return=-42.35%, Trades=91\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.703±0.064\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7722% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7619% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8000% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7890% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-10.28%, Trades=27\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.055\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8048% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-45.69%, Trades=89\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=426, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-0.77%, Test=-4.53%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.543\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.629\n",
      "    📊 Accuracy CV Results: Accuracy 0.674±0.095\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    ✅ Logistic_Standard: Test Return=-40.57%, Trades=94\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0188]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0050\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0041\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0034, Total Loss = 1.8999\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0955\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 1.2739, Standard intercept: 1.2577\n",
      "       MADL coef norm: 1.4487, Standard coef norm: 1.8813\n",
      "       Coefficient difference norm: 0.4331\n",
      "      ✔ Fold 1: MADL accuracy 0.429\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0063\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0050\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 1.8786\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0942\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4723, Standard intercept: 0.4855\n",
      "       MADL coef norm: 1.4780, Standard coef norm: 1.9247\n",
      "       Coefficient difference norm: 0.4473\n",
      "      ✔ Fold 2: MADL accuracy 0.657\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0064\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0050\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0021, Total Loss = 1.2132\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0608\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2555, Standard intercept: 0.2389\n",
      "       MADL coef norm: 1.2446, Standard coef norm: 1.6305\n",
      "       Coefficient difference norm: 0.3869\n",
      "      ✔ Fold 3: MADL accuracy 0.829\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0061\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0048\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 1.4192\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0709\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2695, Standard intercept: 0.2415\n",
      "       MADL coef norm: 1.2516, Standard coef norm: 1.6266\n",
      "       Coefficient difference norm: 0.3758\n",
      "      ✔ Fold 4: MADL accuracy 0.657\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0058\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0046\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 1.4023\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0706\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2893, Standard intercept: 0.2636\n",
      "       MADL coef norm: 1.2480, Standard coef norm: 1.6210\n",
      "       Coefficient difference norm: 0.3732\n",
      "      ✔ Fold 5: MADL accuracy 0.600\n",
      "    📊 MADL CV Results: Accuracy 0.634±0.128\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0046\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 1.3536\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0681\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2153, Standard intercept: 0.1990\n",
      "       MADL coef norm: 1.2329, Standard coef norm: 1.6030\n",
      "       Coefficient difference norm: 0.3706\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    ✅ Logistic_MADL: Test Return=-42.87%, Trades=93\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.486\n",
      "      ✔ Fold 2: Accuracy accuracy 0.514\n",
      "      ✔ Fold 3: Accuracy accuracy 0.571\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.571\n",
      "    📊 Accuracy CV Results: Accuracy 0.554±0.050\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8056% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-30.55%, Trades=53\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.343\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.629\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.629\n",
      "    📊 Accuracy CV Results: Accuracy 0.606±0.137\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8048% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-43.51%, Trades=90\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.429\n",
      "      ✔ Fold 2: Accuracy accuracy 0.543\n",
      "      ✔ Fold 3: Accuracy accuracy 0.629\n",
      "      ✔ Fold 4: Accuracy accuracy 0.571\n",
      "      ✔ Fold 5: Accuracy accuracy 0.571\n",
      "    📊 Accuracy CV Results: Accuracy 0.549±0.066\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8048% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-26.40%, Trades=83\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.400\n",
      "      ✔ Fold 2: Accuracy accuracy 0.514\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.571\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.566±0.103\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    ✅ Neural_Standard: Test Return=-48.09%, Trades=75\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.514\n",
      "      ✔ Fold 2: Accuracy accuracy 0.543\n",
      "      ✔ Fold 3: Accuracy accuracy 0.629\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.571\n",
      "    📊 Accuracy CV Results: Accuracy 0.589±0.062\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7722% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7619% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-23.57%, Trades=37\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.514\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.674±0.086\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7984% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8056% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-38.24%, Trades=76\n",
      "\n",
      "💱 Processing ZAR_USD...\n",
      "    ✅ ZAR_USD: Total=572 days, Train=429 days, Test=143 days\n",
      "       📅 Train: 2018-01-01 to 2019-08-22\n",
      "       📅 Test:  2019-08-23 to 2020-03-10\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 550 rows\n",
      "    ✔ Loaded 13w_tbill: 550 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=427, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-18.45%, Test=-4.15%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.766±0.046\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ Logistic_Standard: Test Return=3.15%, Trades=84\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0253]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0065\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0054\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0037, Total Loss = 2.3619\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1192\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 1.1759, Standard intercept: 1.1302\n",
      "       MADL coef norm: 1.6713, Standard coef norm: 2.1764\n",
      "       Coefficient difference norm: 0.5050\n",
      "      ✔ Fold 1: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0253]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0075\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0060\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0021, Total Loss = 1.5089\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0759\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1988, Standard intercept: 0.2149\n",
      "       MADL coef norm: 1.3129, Standard coef norm: 1.7069\n",
      "       Coefficient difference norm: 0.3940\n",
      "      ✔ Fold 2: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0084\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0065\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 1.5045\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0744\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1137, Standard intercept: -0.0656\n",
      "       MADL coef norm: 1.4073, Standard coef norm: 1.8423\n",
      "       Coefficient difference norm: 0.4352\n",
      "      ✔ Fold 3: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0084\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0064\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 1.7179\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0854\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1390, Standard intercept: 0.1451\n",
      "       MADL coef norm: 1.4174, Standard coef norm: 1.8445\n",
      "       Coefficient difference norm: 0.4272\n",
      "      ✔ Fold 4: MADL accuracy 0.686\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0081\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0028, Total Loss = 1.7887\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0890\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1058, Standard intercept: 0.1298\n",
      "       MADL coef norm: 1.4207, Standard coef norm: 1.8462\n",
      "       Coefficient difference norm: 0.4256\n",
      "      ✔ Fold 5: MADL accuracy 0.800\n",
      "    📊 MADL CV Results: Accuracy 0.754±0.043\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0079\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0031, Total Loss = 1.7935\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0896\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0716, Standard intercept: 0.0259\n",
      "       MADL coef norm: 1.4314, Standard coef norm: 1.8608\n",
      "       Coefficient difference norm: 0.4294\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ Logistic_MADL: Test Return=1.34%, Trades=87\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.714±0.040\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-19.28%, Trades=93\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.749±0.033\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-26.30%, Trades=88\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.726±0.023\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-42.85%, Trades=90\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.829\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.829\n",
      "    📊 Accuracy CV Results: Accuracy 0.771±0.054\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ Neural_Standard: Test Return=0.87%, Trades=85\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.703±0.053\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4884% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6070% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5926% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-4.52%, Trades=22\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.743±0.018\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-24.36%, Trades=91\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=426, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-18.45%, Test=-4.15%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.800\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.737±0.061\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ Logistic_Standard: Test Return=-1.62%, Trades=88\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0253]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0065\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0054\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0028, Total Loss = 1.7731\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0891\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.9008, Standard intercept: 0.8845\n",
      "       MADL coef norm: 1.4400, Standard coef norm: 1.8754\n",
      "       Coefficient difference norm: 0.4359\n",
      "      ✔ Fold 1: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0253]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0075\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0060\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0028, Total Loss = 1.6802\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0844\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1823, Standard intercept: 0.1955\n",
      "       MADL coef norm: 1.3839, Standard coef norm: 1.8006\n",
      "       Coefficient difference norm: 0.4173\n",
      "      ✔ Fold 2: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0084\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0065\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0035, Total Loss = 1.6707\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0825\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0642, Standard intercept: -0.0808\n",
      "       MADL coef norm: 1.4428, Standard coef norm: 1.8868\n",
      "       Coefficient difference norm: 0.4449\n",
      "      ✔ Fold 3: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0084\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0064\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 1.8659\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0930\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1723, Standard intercept: 0.1443\n",
      "       MADL coef norm: 1.4437, Standard coef norm: 1.8767\n",
      "       Coefficient difference norm: 0.4336\n",
      "      ✔ Fold 4: MADL accuracy 0.629\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0081\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 1.8950\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0946\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1643, Standard intercept: 0.1386\n",
      "       MADL coef norm: 1.4529, Standard coef norm: 1.8870\n",
      "       Coefficient difference norm: 0.4343\n",
      "      ✔ Fold 5: MADL accuracy 0.686\n",
      "    📊 MADL CV Results: Accuracy 0.731±0.064\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0079\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 1.8399\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0917\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0322, Standard intercept: 0.0159\n",
      "       MADL coef norm: 1.4396, Standard coef norm: 1.8714\n",
      "       Coefficient difference norm: 0.4323\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ Logistic_MADL: Test Return=-4.06%, Trades=91\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.543\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.663±0.078\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-4.35%, Trades=86\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.457\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.686±0.124\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-12.54%, Trades=94\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.543\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.663±0.064\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=0.22%, Trades=86\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.571\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.646±0.050\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4969% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6144% cost\n",
      "    ✅ Neural_Standard: Test Return=-18.49%, Trades=88\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.571\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.686±0.070\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4884% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6070% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5926% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-4.52%, Trades=22\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.657\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.691±0.042\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6163% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6202% cost\n",
      "    ✅ XGBoost_Standard: Test Return=1.22%, Trades=86\n",
      "\n",
      "💱 Processing TRY_USD...\n",
      "    ✅ TRY_USD: Total=572 days, Train=429 days, Test=143 days\n",
      "       📅 Train: 2018-01-01 to 2019-08-22\n",
      "       📅 Test:  2019-08-23 to 2020-03-10\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 550 rows\n",
      "    ✔ Loaded 13w_tbill: 550 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=427, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-34.27%, Test=-6.62%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.760±0.039\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1753% cost\n",
      "    ✅ Logistic_Standard: Test Return=44.80%, Trades=80\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0171]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0055\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0036\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0024, Total Loss = 1.3076\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0653\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.6566, Standard intercept: -0.7022\n",
      "       MADL coef norm: 1.2095, Standard coef norm: 1.5706\n",
      "       Coefficient difference norm: 0.3612\n",
      "      ✔ Fold 1: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0441]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0080\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0076\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0025, Total Loss = 1.7372\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0869\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.6592, Standard intercept: -0.6432\n",
      "       MADL coef norm: 1.4013, Standard coef norm: 1.8208\n",
      "       Coefficient difference norm: 0.4195\n",
      "      ✔ Fold 2: MADL accuracy 0.714\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0116\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0144\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0042, Total Loss = 1.9276\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0956\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2765, Standard intercept: -0.2284\n",
      "       MADL coef norm: 1.5480, Standard coef norm: 2.0212\n",
      "       Coefficient difference norm: 0.4734\n",
      "      ✔ Fold 3: MADL accuracy 0.857\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0107\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0131\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0049, Total Loss = 2.4265\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1207\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0851, Standard intercept: -0.0647\n",
      "       MADL coef norm: 0.5001, Standard coef norm: 2.1935\n",
      "       Coefficient difference norm: 1.6935\n",
      "      ✔ Fold 4: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0099\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0125\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0043, Total Loss = 2.7496\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1380\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3306, Standard intercept: -0.2507\n",
      "       MADL coef norm: 0.5323, Standard coef norm: 2.2796\n",
      "       Coefficient difference norm: 1.7487\n",
      "      ✔ Fold 5: MADL accuracy 0.486\n",
      "    📊 MADL CV Results: Accuracy 0.714±0.124\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0093\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0117\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0040, Total Loss = 2.7350\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1367\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0085, Standard intercept: -0.1438\n",
      "       MADL coef norm: 0.5308, Standard coef norm: 2.2997\n",
      "       Coefficient difference norm: 1.7692\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1127% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1751% cost\n",
      "    ✅ Logistic_MADL: Test Return=26.00%, Trades=40\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.760±0.029\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1751% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=33.91%, Trades=80\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.777±0.033\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1123% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1751% cost\n",
      "    ✅ RandomForest_Standard: Test Return=36.96%, Trades=82\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.857\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.766±0.061\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1123% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1753% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=25.16%, Trades=80\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.886\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.754±0.071\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1753% cost\n",
      "    ✅ Neural_Standard: Test Return=50.49%, Trades=65\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.771\n",
      "      ✔ Fold 2: Accuracy accuracy 0.657\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.042\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1416% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1377% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1720% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1723% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=0.14%, Trades=2\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.829\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.857\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.794±0.049\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1753% cost\n",
      "    ✅ XGBoost_Standard: Test Return=37.84%, Trades=72\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=426, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-34.27%, Test=-6.62%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.829\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.743\n",
      "      ✔ Fold 4: Accuracy accuracy 0.571\n",
      "      ✔ Fold 5: Accuracy accuracy 0.657\n",
      "    📊 Accuracy CV Results: Accuracy 0.714±0.090\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1751% cost\n",
      "    ✅ Logistic_Standard: Test Return=39.07%, Trades=75\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0171]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0036\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0026, Total Loss = 1.3984\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0701\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.6355, Standard intercept: -0.6518\n",
      "       MADL coef norm: 1.2308, Standard coef norm: 1.5972\n",
      "       Coefficient difference norm: 0.3669\n",
      "      ✔ Fold 1: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0441]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0080\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0076\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 1.9782\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0993\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.6732, Standard intercept: -0.6600\n",
      "       MADL coef norm: 1.4613, Standard coef norm: 1.8958\n",
      "       Coefficient difference norm: 0.4350\n",
      "      ✔ Fold 2: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0116\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0144\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0053, Total Loss = 2.1101\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1044\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2376, Standard intercept: -0.2543\n",
      "       MADL coef norm: 1.5873, Standard coef norm: 2.0709\n",
      "       Coefficient difference norm: 0.4845\n",
      "      ✔ Fold 3: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0107\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0131\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0054, Total Loss = 2.5869\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1281\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0122, Standard intercept: -0.1057\n",
      "       MADL coef norm: 0.5164, Standard coef norm: 2.2354\n",
      "       Coefficient difference norm: 1.7253\n",
      "      ✔ Fold 4: MADL accuracy 0.343\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0099\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0125\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0045, Total Loss = 2.8303\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1416\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1720, Standard intercept: -0.2577\n",
      "       MADL coef norm: 0.5400, Standard coef norm: 2.3200\n",
      "       Coefficient difference norm: 1.7821\n",
      "      ✔ Fold 5: MADL accuracy 0.543\n",
      "    📊 MADL CV Results: Accuracy 0.646±0.178\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0093\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0117\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0043, Total Loss = 2.9354\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1472\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1162, Standard intercept: -0.1705\n",
      "       MADL coef norm: 0.5499, Standard coef norm: 2.3766\n",
      "       Coefficient difference norm: 1.8305\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1751% cost\n",
      "    ✅ Logistic_MADL: Test Return=28.82%, Trades=74\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.731±0.050\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1751% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=33.42%, Trades=60\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.760±0.069\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1123% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1753% cost\n",
      "    ✅ RandomForest_Standard: Test Return=25.48%, Trades=73\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.743\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.829\n",
      "      ✔ Fold 4: Accuracy accuracy 0.686\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.766±0.049\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1123% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1753% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=26.19%, Trades=72\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.743\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.737±0.038\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1751% cost\n",
      "    ✅ Neural_Standard: Test Return=42.39%, Trades=72\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.571\n",
      "      ✔ Fold 5: Accuracy accuracy 0.571\n",
      "    📊 Accuracy CV Results: Accuracy 0.669±0.088\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1123% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1715% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1707% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-0.97%, Trades=17\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.857\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.754±0.086\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1123% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1732% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1751% cost\n",
      "    ✅ XGBoost_Standard: Test Return=31.31%, Trades=69\n",
      "\n",
      "💱 Processing CNY_USD...\n",
      "    ✅ CNY_USD: Total=572 days, Train=429 days, Test=143 days\n",
      "       📅 Train: 2018-01-01 to 2019-08-22\n",
      "       📅 Test:  2019-08-23 to 2020-03-10\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 550 rows\n",
      "    ✔ Loaded 13w_tbill: 550 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=427, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-8.14%, Test=1.85%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.829\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.731±0.059\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ Logistic_Standard: Test Return=-6.62%, Trades=86\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0094]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0021\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.8312\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0936\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4756, Standard intercept: 0.4300\n",
      "       MADL coef norm: 1.4502, Standard coef norm: 1.8858\n",
      "       Coefficient difference norm: 0.4356\n",
      "      ✔ Fold 1: MADL accuracy 0.714\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0094]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0022\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.9093\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0973\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.6541, Standard intercept: -0.6381\n",
      "       MADL coef norm: 1.4832, Standard coef norm: 1.9291\n",
      "       Coefficient difference norm: 0.4460\n",
      "      ✔ Fold 2: MADL accuracy 0.714\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0103]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0021\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.2802\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0652\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.7258, Standard intercept: -0.6777\n",
      "       MADL coef norm: 1.2847, Standard coef norm: 1.6806\n",
      "       Coefficient difference norm: 0.3961\n",
      "      ✔ Fold 3: MADL accuracy 0.743\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0111]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0021\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 1.5988\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0816\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5303, Standard intercept: -0.5241\n",
      "       MADL coef norm: 1.3641, Standard coef norm: 1.7749\n",
      "       Coefficient difference norm: 0.4108\n",
      "      ✔ Fold 4: MADL accuracy 0.829\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0111]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 1.7941\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0917\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5640, Standard intercept: -0.5400\n",
      "       MADL coef norm: 1.4272, Standard coef norm: 1.8552\n",
      "       Coefficient difference norm: 0.4282\n",
      "      ✔ Fold 5: MADL accuracy 0.714\n",
      "    📊 MADL CV Results: Accuracy 0.743±0.044\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 1.9729\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1009\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5682, Standard intercept: -0.6138\n",
      "       MADL coef norm: 1.5011, Standard coef norm: 1.9514\n",
      "       Coefficient difference norm: 0.4504\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ Logistic_MADL: Test Return=-6.30%, Trades=86\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.800\n",
      "      ✔ Fold 3: Accuracy accuracy 0.657\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.726±0.046\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-9.85%, Trades=89\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.731±0.029\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-8.98%, Trades=81\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.011\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-5.97%, Trades=74\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.743\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.657\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.771\n",
      "    📊 Accuracy CV Results: Accuracy 0.726±0.046\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ Neural_Standard: Test Return=-7.14%, Trades=87\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.800\n",
      "      ✔ Fold 3: Accuracy accuracy 0.657\n",
      "      ✔ Fold 4: Accuracy accuracy 0.743\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.731±0.046\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1947% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2146% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=0.67%, Trades=10\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.714\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.697±0.023\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-4.78%, Trades=78\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=426, test=141\n",
      "  📈 Buy-and-hold benchmark: Train=-8.14%, Test=1.85%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.697±0.050\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ Logistic_Standard: Test Return=-7.86%, Trades=86\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0094]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0022\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.7010\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0866\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3380, Standard intercept: 0.3217\n",
      "       MADL coef norm: 1.4016, Standard coef norm: 1.8245\n",
      "       Coefficient difference norm: 0.4233\n",
      "      ✔ Fold 1: MADL accuracy 0.600\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0094]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0022\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.9430\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0991\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.7329, Standard intercept: -0.7197\n",
      "       MADL coef norm: 1.4715, Standard coef norm: 1.9123\n",
      "       Coefficient difference norm: 0.4413\n",
      "      ✔ Fold 2: MADL accuracy 0.771\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0103]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0021\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.3591\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0692\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.7117, Standard intercept: -0.7284\n",
      "       MADL coef norm: 1.2633, Standard coef norm: 1.6484\n",
      "       Coefficient difference norm: 0.3863\n",
      "      ✔ Fold 3: MADL accuracy 0.714\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0111]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0021\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.6742\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0854\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5398, Standard intercept: -0.5678\n",
      "       MADL coef norm: 1.3666, Standard coef norm: 1.7767\n",
      "       Coefficient difference norm: 0.4108\n",
      "      ✔ Fold 4: MADL accuracy 0.714\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0111]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.8377\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0939\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5519, Standard intercept: -0.5777\n",
      "       MADL coef norm: 1.4448, Standard coef norm: 1.8785\n",
      "       Coefficient difference norm: 0.4339\n",
      "      ✔ Fold 5: MADL accuracy 0.800\n",
      "    📊 MADL CV Results: Accuracy 0.720±0.069\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 2.0354\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1042\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.6186, Standard intercept: -0.6348\n",
      "       MADL coef norm: 1.5054, Standard coef norm: 1.9558\n",
      "       Coefficient difference norm: 0.4508\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1958% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ Logistic_MADL: Test Return=-7.32%, Trades=81\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.514\n",
      "      ✔ Fold 2: Accuracy accuracy 0.686\n",
      "      ✔ Fold 3: Accuracy accuracy 0.571\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.714\n",
      "    📊 Accuracy CV Results: Accuracy 0.640±0.082\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-8.78%, Trades=78\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.771\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.714\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.726±0.053\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-7.79%, Trades=81\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.571\n",
      "      ✔ Fold 2: Accuracy accuracy 0.743\n",
      "      ✔ Fold 3: Accuracy accuracy 0.771\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.726±0.080\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1958% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-5.99%, Trades=77\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.400\n",
      "      ✔ Fold 2: Accuracy accuracy 0.629\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.657\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.617±0.112\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2144% cost\n",
      "    ✅ Neural_Standard: Test Return=-6.67%, Trades=64\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.686\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.686\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.686\n",
      "    📊 Accuracy CV Results: Accuracy 0.674±0.039\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1947% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2135% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-2.51%, Trades=11\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.743\n",
      "      ✔ Fold 2: Accuracy accuracy 0.714\n",
      "      ✔ Fold 3: Accuracy accuracy 0.714\n",
      "      ✔ Fold 4: Accuracy accuracy 0.771\n",
      "      ✔ Fold 5: Accuracy accuracy 0.743\n",
      "    📊 Accuracy CV Results: Accuracy 0.737±0.021\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2129% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2149% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-10.00%, Trades=80\n",
      "\n",
      "📊 Period 1 completed: 128 successful model runs\n",
      "\n",
      "📍 PERIOD 2: Training 2020-03-11 to 2021-03-11\n",
      "------------------------------------------------------------\n",
      "\n",
      "💱 Processing EUR_USD...\n",
      "    ✅ EUR_USD: Total=260 days, Train=195 days, Test=65 days\n",
      "       📅 Train: 2020-03-11 to 2020-12-08\n",
      "       📅 Test:  2020-12-09 to 2021-03-11\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 253 rows\n",
      "    ✔ Loaded 13w_tbill: 253 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=193, test=63\n",
      "  📈 Buy-and-hold benchmark: Train=7.28%, Test=-0.97%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.068\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ Logistic_Standard: Test Return=20.27%, Trades=42\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0060\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0046\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0053, Total Loss = 2.8018\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1396\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2953, Standard intercept: -0.4476\n",
      "       MADL coef norm: 0.5374, Standard coef norm: 2.2956\n",
      "       Coefficient difference norm: 1.7583\n",
      "      ✔ Fold 1: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0048\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0036, Total Loss = 3.1298\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1574\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1902, Standard intercept: 0.2437\n",
      "       MADL coef norm: 0.5678, Standard coef norm: 2.4901\n",
      "       Coefficient difference norm: 1.9229\n",
      "      ✔ Fold 2: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0044\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0027, Total Loss = 2.3832\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1197\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4040, Standard intercept: 0.4522\n",
      "       MADL coef norm: 1.7070, Standard coef norm: 2.2270\n",
      "       Coefficient difference norm: 0.5202\n",
      "      ✔ Fold 3: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 2.0209\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1018\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3339, Standard intercept: 0.3400\n",
      "       MADL coef norm: 1.5489, Standard coef norm: 2.0173\n",
      "       Coefficient difference norm: 0.4684\n",
      "      ✔ Fold 4: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0031\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 2.1761\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1101\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3197, Standard intercept: 0.3437\n",
      "       MADL coef norm: 1.5500, Standard coef norm: 2.0118\n",
      "       Coefficient difference norm: 0.4620\n",
      "      ✔ Fold 5: MADL accuracy 0.750\n",
      "    📊 MADL CV Results: Accuracy 0.762±0.047\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0038\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0030\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 1.9775\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1001\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4291, Standard intercept: 0.3834\n",
      "       MADL coef norm: 1.4863, Standard coef norm: 1.9299\n",
      "       Coefficient difference norm: 0.4437\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ Logistic_MADL: Test Return=16.82%, Trades=36\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.056\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=18.34%, Trades=27\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.938\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.105\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ RandomForest_Standard: Test Return=18.95%, Trades=31\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.085\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=17.27%, Trades=35\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.064\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ Neural_Standard: Test Return=18.53%, Trades=39\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.050\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=12.00%, Trades=35\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.938\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.108\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ XGBoost_Standard: Test Return=16.24%, Trades=34\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=193, test=63\n",
      "  📈 Buy-and-hold benchmark: Train=7.28%, Test=-0.97%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.079\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ Logistic_Standard: Test Return=20.27%, Trades=42\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0060\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0046\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0060, Total Loss = 3.1060\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1556\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3465, Standard intercept: -0.4008\n",
      "       MADL coef norm: 0.5658, Standard coef norm: 2.3690\n",
      "       Coefficient difference norm: 1.8062\n",
      "      ✔ Fold 1: MADL accuracy 0.562\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0048\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0037, Total Loss = 3.5069\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1765\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1437, Standard intercept: 0.1876\n",
      "       MADL coef norm: 0.6010, Standard coef norm: 2.5976\n",
      "       Coefficient difference norm: 2.0011\n",
      "      ✔ Fold 2: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0044\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0026, Total Loss = 2.6679\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1347\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4529, Standard intercept: 0.3973\n",
      "       MADL coef norm: 0.5242, Standard coef norm: 2.2922\n",
      "       Coefficient difference norm: 1.7776\n",
      "      ✔ Fold 3: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0023, Total Loss = 2.2774\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1151\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3717, Standard intercept: 0.3437\n",
      "       MADL coef norm: 1.6488, Standard coef norm: 2.1499\n",
      "       Coefficient difference norm: 0.5016\n",
      "      ✔ Fold 4: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0031\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0021, Total Loss = 2.4123\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1222\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4005, Standard intercept: 0.3748\n",
      "       MADL coef norm: 1.6437, Standard coef norm: 2.1352\n",
      "       Coefficient difference norm: 0.4917\n",
      "      ✔ Fold 5: MADL accuracy 0.688\n",
      "    📊 MADL CV Results: Accuracy 0.700±0.083\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0038\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0030\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 2.2662\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1149\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4132, Standard intercept: 0.3969\n",
      "       MADL coef norm: 1.5647, Standard coef norm: 2.0294\n",
      "       Coefficient difference norm: 0.4651\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ Logistic_MADL: Test Return=16.77%, Trades=35\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.562\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.085\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=14.12%, Trades=29\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.068\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ RandomForest_Standard: Test Return=16.48%, Trades=36\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.050\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=16.53%, Trades=29\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.040\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ Neural_Standard: Test Return=16.26%, Trades=30\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.500\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.094\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0108% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0098% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0098% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=9.84%, Trades=31\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.073\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0106% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0112% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    ✅ XGBoost_Standard: Test Return=15.76%, Trades=31\n",
      "\n",
      "💱 Processing JPY_USD...\n",
      "    ✅ JPY_USD: Total=262 days, Train=196 days, Test=66 days\n",
      "       📅 Train: 2020-03-11 to 2020-12-09\n",
      "       📅 Test:  2020-12-10 to 2021-03-11\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 253 rows\n",
      "    ✔ Loaded 13w_tbill: 253 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=1.03%, Test=-3.94%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.700±0.025\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ Logistic_Standard: Test Return=14.44%, Trades=29\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0063\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0075\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0054, Total Loss = 2.2372\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1100\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1065, Standard intercept: -0.1522\n",
      "       MADL coef norm: 1.6008, Standard coef norm: 2.0811\n",
      "       Coefficient difference norm: 0.4804\n",
      "      ✔ Fold 1: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0047\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0058\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 3.0681\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1555\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3977, Standard intercept: -0.3442\n",
      "       MADL coef norm: 0.5621, Standard coef norm: 2.4363\n",
      "       Coefficient difference norm: 1.8747\n",
      "      ✔ Fold 2: MADL accuracy 0.562\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0050\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0021, Total Loss = 2.0907\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1063\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3634, Standard intercept: -0.3153\n",
      "       MADL coef norm: 1.6571, Standard coef norm: 2.1689\n",
      "       Coefficient difference norm: 0.5119\n",
      "      ✔ Fold 3: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0037\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0045\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 2.1282\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1081\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3052, Standard intercept: -0.2991\n",
      "       MADL coef norm: 1.5793, Standard coef norm: 2.0556\n",
      "       Coefficient difference norm: 0.4763\n",
      "      ✔ Fold 4: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0034\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0042\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 2.3704\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1208\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2366, Standard intercept: -0.2127\n",
      "       MADL coef norm: 1.6527, Standard coef norm: 2.1498\n",
      "       Coefficient difference norm: 0.4973\n",
      "      ✔ Fold 5: MADL accuracy 0.688\n",
      "    📊 MADL CV Results: Accuracy 0.688±0.068\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0033\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0041\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 2.5614\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1306\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0510, Standard intercept: -0.1013\n",
      "       MADL coef norm: 0.5135, Standard coef norm: 2.2224\n",
      "       Coefficient difference norm: 1.7093\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ Logistic_MADL: Test Return=7.87%, Trades=45\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.625\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.613±0.047\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=12.89%, Trades=29\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.700±0.073\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ RandomForest_Standard: Test Return=13.68%, Trades=30\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.025\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=11.23%, Trades=41\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.064\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ Neural_Standard: Test Return=13.96%, Trades=29\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.108\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1556% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1553% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-0.09%, Trades=21\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.085\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ XGBoost_Standard: Test Return=10.72%, Trades=38\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=1.03%, Test=-3.94%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.040\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ Logistic_Standard: Test Return=12.84%, Trades=37\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0063\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0075\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0058, Total Loss = 2.6758\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1321\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0323, Standard intercept: -0.0219\n",
      "       MADL coef norm: 0.5252, Standard coef norm: 2.2133\n",
      "       Coefficient difference norm: 1.6916\n",
      "      ✔ Fold 1: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0047\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0058\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0037, Total Loss = 4.2615\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.2166\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3397, Standard intercept: -0.2958\n",
      "       MADL coef norm: 0.6624, Standard coef norm: 2.8126\n",
      "       Coefficient difference norm: 2.1539\n",
      "      ✔ Fold 2: MADL accuracy 0.562\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0050\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0023, Total Loss = 2.6459\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1339\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2148, Standard intercept: -0.2703\n",
      "       MADL coef norm: 0.5220, Standard coef norm: 2.4641\n",
      "       Coefficient difference norm: 1.9493\n",
      "      ✔ Fold 3: MADL accuracy 0.562\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0037\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0045\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0020, Total Loss = 2.3842\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1205\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2614, Standard intercept: -0.2894\n",
      "       MADL coef norm: 1.7017, Standard coef norm: 2.2205\n",
      "       Coefficient difference norm: 0.5194\n",
      "      ✔ Fold 4: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0034\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0042\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 2.5736\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1309\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1332, Standard intercept: -0.2189\n",
      "       MADL coef norm: 0.5147, Standard coef norm: 2.2724\n",
      "       Coefficient difference norm: 1.7600\n",
      "      ✔ Fold 5: MADL accuracy 0.688\n",
      "    📊 MADL CV Results: Accuracy 0.650±0.075\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0298]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0033\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0041\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 2.7560\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1404\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0375, Standard intercept: -0.0917\n",
      "       MADL coef norm: 0.5326, Standard coef norm: 2.2666\n",
      "       Coefficient difference norm: 1.7378\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ Logistic_MADL: Test Return=0.73%, Trades=40\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.500\n",
      "      ✔ Fold 3: Accuracy accuracy 0.500\n",
      "      ✔ Fold 4: Accuracy accuracy 0.500\n",
      "      ✔ Fold 5: Accuracy accuracy 0.500\n",
      "    📊 Accuracy CV Results: Accuracy 0.537±0.075\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1547% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=13.23%, Trades=21\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.112\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ RandomForest_Standard: Test Return=11.94%, Trades=30\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.438\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.140\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=7.51%, Trades=34\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.875\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.438\n",
      "      ✔ Fold 4: Accuracy accuracy 0.938\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.713±0.179\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ Neural_Standard: Test Return=-0.69%, Trades=31\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.637±0.092\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1572% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1553% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1550% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=5.02%, Trades=29\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.102\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1567% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1621% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1564% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1560% cost\n",
      "    ✅ XGBoost_Standard: Test Return=7.68%, Trades=33\n",
      "\n",
      "💱 Processing AUD_USD...\n",
      "    ✅ AUD_USD: Total=262 days, Train=196 days, Test=66 days\n",
      "       📅 Train: 2020-03-11 to 2020-12-09\n",
      "       📅 Test:  2020-12-10 to 2021-03-11\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 253 rows\n",
      "    ✔ Loaded 13w_tbill: 253 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=14.44%, Test=4.63%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.875\n",
      "    📊 Accuracy CV Results: Accuracy 0.713±0.102\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0262% cost\n",
      "    ✅ Logistic_Standard: Test Return=29.42%, Trades=37\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0099\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0077\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0066, Total Loss = 1.8257\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0910\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5482, Standard intercept: 0.5025\n",
      "       MADL coef norm: 1.4255, Standard coef norm: 1.8504\n",
      "       Coefficient difference norm: 0.4249\n",
      "      ✔ Fold 1: MADL accuracy 0.562\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0084\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0068\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0056, Total Loss = 2.0049\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0991\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5414, Standard intercept: 0.5574\n",
      "       MADL coef norm: 1.5360, Standard coef norm: 1.9996\n",
      "       Coefficient difference norm: 0.4637\n",
      "      ✔ Fold 2: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0073\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0063\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0034, Total Loss = 1.8743\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0932\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3628, Standard intercept: 0.4110\n",
      "       MADL coef norm: 1.5198, Standard coef norm: 1.9836\n",
      "       Coefficient difference norm: 0.4640\n",
      "      ✔ Fold 3: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0066\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0059\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 2.0330\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1026\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4334, Standard intercept: 0.4395\n",
      "       MADL coef norm: 1.5445, Standard coef norm: 2.0104\n",
      "       Coefficient difference norm: 0.4659\n",
      "      ✔ Fold 4: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0062\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0055\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 2.2488\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1132\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3567, Standard intercept: 0.3807\n",
      "       MADL coef norm: 1.5755, Standard coef norm: 2.0449\n",
      "       Coefficient difference norm: 0.4695\n",
      "      ✔ Fold 5: MADL accuracy 0.875\n",
      "    📊 MADL CV Results: Accuracy 0.713±0.102\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0058\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0054\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0026, Total Loss = 2.3942\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1215\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4518, Standard intercept: 0.4061\n",
      "       MADL coef norm: 1.6487, Standard coef norm: 2.1426\n",
      "       Coefficient difference norm: 0.4939\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0262% cost\n",
      "    ✅ Logistic_MADL: Test Return=29.42%, Trades=37\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.438\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.500\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.588±0.116\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0348% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=25.45%, Trades=45\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.875\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.085\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0265% cost\n",
      "    ✅ RandomForest_Standard: Test Return=26.29%, Trades=40\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.438\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.125\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0262% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=30.42%, Trades=37\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.875\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.085\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0262% cost\n",
      "    ✅ Neural_Standard: Test Return=29.16%, Trades=38\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.500\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.625±0.079\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0321% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0265% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=9.52%, Trades=22\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.025\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0348% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0265% cost\n",
      "    ✅ XGBoost_Standard: Test Return=28.17%, Trades=37\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=14.44%, Test=4.63%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.938\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.121\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    ✅ Logistic_Standard: Test Return=23.70%, Trades=37\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0099\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0077\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0063, Total Loss = 1.7919\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0868\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4996, Standard intercept: 0.4834\n",
      "       MADL coef norm: 1.4087, Standard coef norm: 1.8296\n",
      "       Coefficient difference norm: 0.4213\n",
      "      ✔ Fold 1: MADL accuracy 0.562\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0084\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0068\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0049, Total Loss = 2.1265\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1053\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5815, Standard intercept: 0.5946\n",
      "       MADL coef norm: 1.5829, Standard coef norm: 2.0623\n",
      "       Coefficient difference norm: 0.4799\n",
      "      ✔ Fold 2: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0073\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0063\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0034, Total Loss = 2.1056\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1051\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4739, Standard intercept: 0.4572\n",
      "       MADL coef norm: 1.5640, Standard coef norm: 2.0379\n",
      "       Coefficient difference norm: 0.4749\n",
      "      ✔ Fold 3: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0066\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0059\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 2.3530\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1185\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5418, Standard intercept: 0.5138\n",
      "       MADL coef norm: 1.6367, Standard coef norm: 2.1291\n",
      "       Coefficient difference norm: 0.4930\n",
      "      ✔ Fold 4: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0062\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0055\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 2.4389\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1235\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5063, Standard intercept: 0.4206\n",
      "       MADL coef norm: 0.5012, Standard coef norm: 2.1294\n",
      "       Coefficient difference norm: 1.6304\n",
      "      ✔ Fold 5: MADL accuracy 0.688\n",
      "    📊 MADL CV Results: Accuracy 0.713±0.085\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0376]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0058\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0054\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0025, Total Loss = 2.6805\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1356\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5104, Standard intercept: 0.4562\n",
      "       MADL coef norm: 0.5254, Standard coef norm: 2.2490\n",
      "       Coefficient difference norm: 1.7275\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0321% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0264% cost\n",
      "    ✅ Logistic_MADL: Test Return=8.74%, Trades=17\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.613±0.073\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0348% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=27.00%, Trades=37\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.875\n",
      "    📊 Accuracy CV Results: Accuracy 0.713±0.116\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0265% cost\n",
      "    ✅ RandomForest_Standard: Test Return=27.21%, Trades=38\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.068\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0265% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=25.31%, Trades=35\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.075\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0347% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0265% cost\n",
      "    ✅ Neural_Standard: Test Return=15.29%, Trades=31\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.438\n",
      "      ✔ Fold 4: Accuracy accuracy 0.562\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.613±0.108\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0321% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0263% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0260% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=11.35%, Trades=14\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.713±0.064\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0308% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0348% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0266% cost\n",
      "    ✅ XGBoost_Standard: Test Return=25.92%, Trades=37\n",
      "\n",
      "💱 Processing CHF_USD...\n",
      "    ✅ CHF_USD: Total=262 days, Train=196 days, Test=66 days\n",
      "       📅 Train: 2020-03-11 to 2020-12-09\n",
      "       📅 Test:  2020-12-10 to 2021-03-11\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 253 rows\n",
      "    ✔ Loaded 13w_tbill: 253 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=5.63%, Test=-3.83%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.079\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ Logistic_Standard: Test Return=19.12%, Trades=38\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0053\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0047\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 1.8808\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0936\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4271, Standard intercept: -0.4728\n",
      "       MADL coef norm: 1.4621, Standard coef norm: 1.9002\n",
      "       Coefficient difference norm: 0.4381\n",
      "      ✔ Fold 1: MADL accuracy 0.625\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0044\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0026, Total Loss = 2.0846\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1048\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0340, Standard intercept: 0.0501\n",
      "       MADL coef norm: 1.5370, Standard coef norm: 1.9973\n",
      "       Coefficient difference norm: 0.4604\n",
      "      ✔ Fold 2: MADL accuracy 0.625\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0016, Total Loss = 1.6121\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0809\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1938, Standard intercept: 0.2419\n",
      "       MADL coef norm: 1.4521, Standard coef norm: 1.9004\n",
      "       Coefficient difference norm: 0.4485\n",
      "      ✔ Fold 3: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0038\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0032\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 1.6866\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0848\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2467, Standard intercept: 0.2529\n",
      "       MADL coef norm: 1.4076, Standard coef norm: 1.8323\n",
      "       Coefficient difference norm: 0.4247\n",
      "      ✔ Fold 4: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0036\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0031\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.8489\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0932\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2905, Standard intercept: 0.3145\n",
      "       MADL coef norm: 1.4417, Standard coef norm: 1.8732\n",
      "       Coefficient difference norm: 0.4316\n",
      "      ✔ Fold 5: MADL accuracy 0.625\n",
      "    📊 MADL CV Results: Accuracy 0.688±0.079\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0035\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0031\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 1.6191\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0821\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4310, Standard intercept: 0.3853\n",
      "       MADL coef norm: 1.3477, Standard coef norm: 1.7504\n",
      "       Coefficient difference norm: 0.4027\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ Logistic_MADL: Test Return=16.90%, Trades=37\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.438\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.637±0.121\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=12.45%, Trades=38\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.105\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ RandomForest_Standard: Test Return=12.74%, Trades=40\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.073\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=11.15%, Trades=43\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.500\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.650±0.102\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ Neural_Standard: Test Return=17.28%, Trades=40\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.050\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0221% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=9.89%, Trades=39\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.102\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ XGBoost_Standard: Test Return=10.99%, Trades=35\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=5.63%, Test=-3.83%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.500\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.500\n",
      "    📊 Accuracy CV Results: Accuracy 0.637±0.127\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ Logistic_Standard: Test Return=9.65%, Trades=34\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0053\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0047\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0045, Total Loss = 2.7903\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1406\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3502, Standard intercept: -0.4044\n",
      "       MADL coef norm: 0.5362, Standard coef norm: 2.2504\n",
      "       Coefficient difference norm: 1.7175\n",
      "      ✔ Fold 1: MADL accuracy 0.438\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0044\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0035, Total Loss = 2.9417\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1482\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0247, Standard intercept: 0.0192\n",
      "       MADL coef norm: 0.5504, Standard coef norm: 2.3363\n",
      "       Coefficient difference norm: 1.7905\n",
      "      ✔ Fold 2: MADL accuracy 0.625\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0025, Total Loss = 2.1653\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1092\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2305, Standard intercept: 0.2138\n",
      "       MADL coef norm: 1.6153, Standard coef norm: 2.1084\n",
      "       Coefficient difference norm: 0.4939\n",
      "      ✔ Fold 3: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0038\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0032\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0021, Total Loss = 2.1780\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1104\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3264, Standard intercept: 0.2984\n",
      "       MADL coef norm: 1.5999, Standard coef norm: 2.0847\n",
      "       Coefficient difference norm: 0.4854\n",
      "      ✔ Fold 4: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0036\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0031\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0016, Total Loss = 2.3288\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1184\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3750, Standard intercept: 0.3493\n",
      "       MADL coef norm: 1.6329, Standard coef norm: 2.1236\n",
      "       Coefficient difference norm: 0.4909\n",
      "      ✔ Fold 5: MADL accuracy 0.500\n",
      "    📊 MADL CV Results: Accuracy 0.625±0.143\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0035\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0031\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 2.0532\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1044\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4384, Standard intercept: 0.4221\n",
      "       MADL coef norm: 1.4862, Standard coef norm: 1.9273\n",
      "       Coefficient difference norm: 0.4415\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ Logistic_MADL: Test Return=8.59%, Trades=35\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.438\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.637±0.121\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=12.45%, Trades=38\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.438\n",
      "    📊 Accuracy CV Results: Accuracy 0.625±0.137\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0247% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ RandomForest_Standard: Test Return=12.13%, Trades=36\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.438\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.637±0.133\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0247% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=10.24%, Trades=33\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.500\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.625±0.112\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0247% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0221% cost\n",
      "    ✅ Neural_Standard: Test Return=-5.55%, Trades=12\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.438\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.625\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.588±0.085\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=9.72%, Trades=36\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.100\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0235% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ XGBoost_Standard: Test Return=12.31%, Trades=34\n",
      "\n",
      "💱 Processing MXN_USD...\n",
      "    ✅ MXN_USD: Total=262 days, Train=196 days, Test=66 days\n",
      "       📅 Train: 2020-03-11 to 2020-12-09\n",
      "       📅 Test:  2020-12-10 to 2021-03-11\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 253 rows\n",
      "    ✔ Loaded 13w_tbill: 253 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=4.52%, Test=-3.73%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.040\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8763% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    ✅ Logistic_Standard: Test Return=-17.90%, Trades=40\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0165\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0113\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0160, Total Loss = 2.1247\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1020\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.3283, Standard intercept: -1.3739\n",
      "       MADL coef norm: 1.5674, Standard coef norm: 2.0381\n",
      "       Coefficient difference norm: 0.4708\n",
      "      ✔ Fold 1: MADL accuracy 0.438\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0139\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0097\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0084, Total Loss = 2.0260\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0960\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1867, Standard intercept: -0.1707\n",
      "       MADL coef norm: 1.5210, Standard coef norm: 1.9770\n",
      "       Coefficient difference norm: 0.4560\n",
      "      ✔ Fold 2: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0121\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0097\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0069, Total Loss = 1.6988\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0819\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3196, Standard intercept: -0.2714\n",
      "       MADL coef norm: 1.4741, Standard coef norm: 1.9270\n",
      "       Coefficient difference norm: 0.4532\n",
      "      ✔ Fold 3: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0106\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0091\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0049, Total Loss = 1.8526\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0905\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1228, Standard intercept: -0.1166\n",
      "       MADL coef norm: 1.4806, Standard coef norm: 1.9279\n",
      "       Coefficient difference norm: 0.4473\n",
      "      ✔ Fold 4: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0101\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0086\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0044, Total Loss = 2.0318\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1002\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0008, Standard intercept: 0.0248\n",
      "       MADL coef norm: 1.5250, Standard coef norm: 1.9829\n",
      "       Coefficient difference norm: 0.4581\n",
      "      ✔ Fold 5: MADL accuracy 0.750\n",
      "    📊 MADL CV Results: Accuracy 0.700±0.133\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0094\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0081\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0032, Total Loss = 2.0173\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1012\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2564, Standard intercept: 0.2107\n",
      "       MADL coef norm: 1.5089, Standard coef norm: 1.9603\n",
      "       Coefficient difference norm: 0.4514\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8763% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    ✅ Logistic_MADL: Test Return=-15.39%, Trades=34\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.812\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.625\n",
      "      ✔ Fold 5: Accuracy accuracy 0.438\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.153\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7982% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-29.55%, Trades=29\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.875\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.713±0.102\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7926% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-27.73%, Trades=45\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.500\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.092\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7926% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-18.37%, Trades=43\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.875\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.092\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8763% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    ✅ Neural_Standard: Test Return=-15.89%, Trades=36\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.688±0.068\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8763% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7971% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-4.24%, Trades=20\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.875\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.105\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7926% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-22.62%, Trades=44\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=4.52%, Test=-3.73%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.115\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8763% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    ✅ Logistic_Standard: Test Return=-17.90%, Trades=40\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0005, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0165\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0113\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0146, Total Loss = 2.3468\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1134\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.5629, Standard intercept: -1.5792\n",
      "       MADL coef norm: 1.6146, Standard coef norm: 2.0966\n",
      "       Coefficient difference norm: 0.4823\n",
      "      ✔ Fold 1: MADL accuracy 0.438\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0139\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0097\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0083, Total Loss = 2.6873\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1291\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3491, Standard intercept: -0.3052\n",
      "       MADL coef norm: 0.5266, Standard coef norm: 2.2443\n",
      "       Coefficient difference norm: 1.7227\n",
      "      ✔ Fold 2: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0121\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0097\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0073, Total Loss = 2.7186\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1336\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3267, Standard intercept: -0.3823\n",
      "       MADL coef norm: 0.5296, Standard coef norm: 2.2122\n",
      "       Coefficient difference norm: 1.6917\n",
      "      ✔ Fold 3: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0106\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0091\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0054, Total Loss = 2.5902\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1268\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1296, Standard intercept: -0.2232\n",
      "       MADL coef norm: 0.5168, Standard coef norm: 2.2045\n",
      "       Coefficient difference norm: 1.6939\n",
      "      ✔ Fold 4: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0101\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0086\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0052, Total Loss = 2.5210\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1244\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0131, Standard intercept: -0.0989\n",
      "       MADL coef norm: 0.5098, Standard coef norm: 2.1930\n",
      "       Coefficient difference norm: 1.6855\n",
      "      ✔ Fold 5: MADL accuracy 0.812\n",
      "    📊 MADL CV Results: Accuracy 0.713±0.140\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0094\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0081\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0045, Total Loss = 2.2815\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1146\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1879, Standard intercept: 0.1716\n",
      "       MADL coef norm: 1.5883, Standard coef norm: 2.0625\n",
      "       Coefficient difference norm: 0.4745\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    ✅ Logistic_MADL: Test Return=-14.81%, Trades=37\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.500\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.250\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.550±0.174\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-28.19%, Trades=38\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.500\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.650±0.109\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-18.80%, Trades=39\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.500\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.500\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.613±0.100\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7926% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-20.13%, Trades=42\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.500\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.127\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    ✅ Neural_Standard: Test Return=-26.51%, Trades=24\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.375\n",
      "    📊 Accuracy CV Results: Accuracy 0.600±0.129\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.9600% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8104% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7971% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-7.42%, Trades=28\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.938\n",
      "      ✔ Fold 3: Accuracy accuracy 0.438\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.562\n",
      "    📊 Accuracy CV Results: Accuracy 0.650±0.166\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8577% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 1.0164% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8011% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8060% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-27.90%, Trades=49\n",
      "\n",
      "💱 Processing ZAR_USD...\n",
      "    ✅ ZAR_USD: Total=260 days, Train=195 days, Test=65 days\n",
      "       📅 Train: 2020-03-11 to 2020-12-08\n",
      "       📅 Test:  2020-12-09 to 2021-03-11\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 253 rows\n",
      "    ✔ Loaded 13w_tbill: 253 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=193, test=63\n",
      "  📈 Buy-and-hold benchmark: Train=6.55%, Test=1.66%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.775±0.085\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6667% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6920% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5839% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6042% cost\n",
      "    ✅ Logistic_Standard: Test Return=2.28%, Trades=2\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0018, 0.0333]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0124\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0080\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0102, Total Loss = 1.5836\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0745\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.6276, Standard intercept: -1.6733\n",
      "       MADL coef norm: 1.3613, Standard coef norm: 1.7713\n",
      "       Coefficient difference norm: 0.4101\n",
      "      ✔ Fold 1: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0333]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0108\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0076\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0066, Total Loss = 2.2504\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1125\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4441, Standard intercept: -0.4281\n",
      "       MADL coef norm: 1.5931, Standard coef norm: 2.0694\n",
      "       Coefficient difference norm: 0.4764\n",
      "      ✔ Fold 2: MADL accuracy 0.625\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0099\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0077\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0042, Total Loss = 1.5442\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0770\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4222, Standard intercept: -0.3740\n",
      "       MADL coef norm: 1.4161, Standard coef norm: 1.8527\n",
      "       Coefficient difference norm: 0.4368\n",
      "      ✔ Fold 3: MADL accuracy 0.875\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0097\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0074\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 1.9484\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0962\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3171, Standard intercept: -0.3109\n",
      "       MADL coef norm: 1.5152, Standard coef norm: 1.9726\n",
      "       Coefficient difference norm: 0.4574\n",
      "      ✔ Fold 4: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0092\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0071\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0036, Total Loss = 2.2274\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1112\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3266, Standard intercept: -0.3026\n",
      "       MADL coef norm: 1.6041, Standard coef norm: 2.0868\n",
      "       Coefficient difference norm: 0.4828\n",
      "      ✔ Fold 5: MADL accuracy 0.812\n",
      "    📊 MADL CV Results: Accuracy 0.775±0.085\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0089\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0070\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0039, Total Loss = 2.2489\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1128\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0739, Standard intercept: 0.0283\n",
      "       MADL coef norm: 1.5987, Standard coef norm: 2.0776\n",
      "       Coefficient difference norm: 0.4790\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6051% cost\n",
      "    ✅ Logistic_MADL: Test Return=18.90%, Trades=33\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.056\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=1.86%, Trades=35\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.800±0.073\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ RandomForest_Standard: Test Return=4.80%, Trades=36\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.040\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6051% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-0.16%, Trades=36\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.938\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.108\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ Neural_Standard: Test Return=16.55%, Trades=34\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.812\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.500\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.122\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6557% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6689% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6051% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=2.88%, Trades=21\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.787±0.064\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ XGBoost_Standard: Test Return=6.10%, Trades=36\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=193, test=63\n",
      "  📈 Buy-and-hold benchmark: Train=6.55%, Test=1.66%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.073\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ Logistic_Standard: Test Return=1.19%, Trades=38\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0018, 0.0333]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0124\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0080\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0117, Total Loss = 2.6347\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1286\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.8557, Standard intercept: -1.9099\n",
      "       MADL coef norm: 0.5218, Standard coef norm: 2.2779\n",
      "       Coefficient difference norm: 1.7602\n",
      "      ✔ Fold 1: MADL accuracy 0.438\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0333]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0108\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0076\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0073, Total Loss = 2.8681\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1434\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5366, Standard intercept: -0.4926\n",
      "       MADL coef norm: 0.5439, Standard coef norm: 2.3241\n",
      "       Coefficient difference norm: 1.7851\n",
      "      ✔ Fold 2: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0099\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0077\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0054, Total Loss = 2.3038\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1142\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4544, Standard intercept: -0.4710\n",
      "       MADL coef norm: 1.6486, Standard coef norm: 2.1493\n",
      "       Coefficient difference norm: 0.5016\n",
      "      ✔ Fold 3: MADL accuracy 0.875\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0097\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0074\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0042, Total Loss = 2.6186\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1293\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2916, Standard intercept: -0.3852\n",
      "       MADL coef norm: 0.5194, Standard coef norm: 2.2658\n",
      "       Coefficient difference norm: 1.7525\n",
      "      ✔ Fold 4: MADL accuracy 0.875\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0092\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0071\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0044, Total Loss = 2.8500\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1422\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2813, Standard intercept: -0.3670\n",
      "       MADL coef norm: 0.5419, Standard coef norm: 2.3683\n",
      "       Coefficient difference norm: 1.8287\n",
      "      ✔ Fold 5: MADL accuracy 0.562\n",
      "    📊 MADL CV Results: Accuracy 0.700±0.174\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0089\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0070\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0035, Total Loss = 2.8889\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1455\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0363, Standard intercept: -0.0180\n",
      "       MADL coef norm: 0.5455, Standard coef norm: 2.3369\n",
      "       Coefficient difference norm: 1.7952\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5848% cost\n",
      "    ✅ Logistic_MADL: Test Return=10.38%, Trades=40\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.875\n",
      "      ✔ Fold 2: Accuracy accuracy 0.812\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.800±0.047\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5848% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=0.06%, Trades=40\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.875\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.938\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.838±0.064\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7092% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6051% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ RandomForest_Standard: Test Return=12.44%, Trades=34\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.875\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.092\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7092% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5848% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=10.32%, Trades=36\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.938\n",
      "      ✔ Fold 5: Accuracy accuracy 0.875\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.133\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7092% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ Neural_Standard: Test Return=-0.96%, Trades=26\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.064\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6656% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6051% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5988% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=3.04%, Trades=19\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.938\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.800±0.073\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6536% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7092% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6033% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6088% cost\n",
      "    ✅ XGBoost_Standard: Test Return=3.04%, Trades=32\n",
      "\n",
      "💱 Processing TRY_USD...\n",
      "    ✅ TRY_USD: Total=262 days, Train=196 days, Test=66 days\n",
      "       📅 Train: 2020-03-11 to 2020-12-09\n",
      "       📅 Test:  2020-12-10 to 2021-03-11\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 253 rows\n",
      "    ✔ Loaded 13w_tbill: 253 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=-21.13%, Test=4.84%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.938\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.775±0.094\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1933% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2366% cost\n",
      "    ✅ Logistic_Standard: Test Return=49.15%, Trades=35\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0205]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0070\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0060\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0047, Total Loss = 2.1130\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1050\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -2.0808, Standard intercept: -2.1265\n",
      "       MADL coef norm: 1.5334, Standard coef norm: 1.9906\n",
      "       Coefficient difference norm: 0.4572\n",
      "      ✔ Fold 1: MADL accuracy 0.500\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0205]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0061\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0057\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0037, Total Loss = 3.4054\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1740\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.3324, Standard intercept: -1.2789\n",
      "       MADL coef norm: 0.5922, Standard coef norm: 2.5572\n",
      "       Coefficient difference norm: 1.9654\n",
      "      ✔ Fold 2: MADL accuracy 0.625\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0205]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0045\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0053\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 2.5504\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1303\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.2044, Standard intercept: -1.0439\n",
      "       MADL coef norm: 0.5124, Standard coef norm: 2.3620\n",
      "       Coefficient difference norm: 1.8513\n",
      "      ✔ Fold 3: MADL accuracy 0.750\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0049\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0055\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0020, Total Loss = 2.8363\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1446\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.1540, Standard intercept: -1.1336\n",
      "       MADL coef norm: 0.5404, Standard coef norm: 2.3872\n",
      "       Coefficient difference norm: 1.8470\n",
      "      ✔ Fold 4: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0050\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0053\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0016, Total Loss = 2.4938\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1271\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.1286, Standard intercept: -1.0487\n",
      "       MADL coef norm: 0.5067, Standard coef norm: 2.2003\n",
      "       Coefficient difference norm: 1.6953\n",
      "      ✔ Fold 5: MADL accuracy 0.812\n",
      "    📊 MADL CV Results: Accuracy 0.675±0.108\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0537]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0058\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0073\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 2.5228\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1285\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5409, Standard intercept: -0.6932\n",
      "       MADL coef norm: 0.5096, Standard coef norm: 2.1964\n",
      "       Coefficient difference norm: 1.6870\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2359% cost\n",
      "    ✅ Logistic_MADL: Test Return=14.42%, Trades=31\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.625\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.092\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2363% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=40.99%, Trades=32\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.108\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2366% cost\n",
      "    ✅ RandomForest_Standard: Test Return=51.71%, Trades=33\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.116\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2366% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=45.78%, Trades=35\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.938\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.100\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1933% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2366% cost\n",
      "    ✅ Neural_Standard: Test Return=41.82%, Trades=38\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.083\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1899% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2347% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2318% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=18.39%, Trades=23\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.938\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.875\n",
      "    📊 Accuracy CV Results: Accuracy 0.787±0.109\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2366% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2359% cost\n",
      "    ✅ XGBoost_Standard: Test Return=58.23%, Trades=30\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=-21.13%, Test=4.84%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.061\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2359% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2294% cost\n",
      "    ✅ Logistic_Standard: Test Return=29.68%, Trades=31\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0003, 0.0205]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0070\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0060\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0045, Total Loss = 2.3389\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1166\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -2.2242, Standard intercept: -2.2404\n",
      "       MADL coef norm: 1.6175, Standard coef norm: 2.1015\n",
      "       Coefficient difference norm: 0.4844\n",
      "      ✔ Fold 1: MADL accuracy 0.500\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0205]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0061\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0057\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0036, Total Loss = 3.2395\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1655\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.3282, Standard intercept: -1.2843\n",
      "       MADL coef norm: 0.5776, Standard coef norm: 2.4998\n",
      "       Coefficient difference norm: 1.9268\n",
      "      ✔ Fold 2: MADL accuracy 0.625\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0205]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0045\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0053\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0023, Total Loss = 2.7559\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1408\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.0721, Standard intercept: -1.1276\n",
      "       MADL coef norm: 0.5327, Standard coef norm: 2.3593\n",
      "       Coefficient difference norm: 1.8359\n",
      "      ✔ Fold 3: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0049\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0055\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0022, Total Loss = 3.0071\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1534\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.0920, Standard intercept: -1.1855\n",
      "       MADL coef norm: 0.5564, Standard coef norm: 2.4244\n",
      "       Coefficient difference norm: 1.8738\n",
      "      ✔ Fold 4: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0050\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0053\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 2.6464\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1348\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.0048, Standard intercept: -1.0905\n",
      "       MADL coef norm: 0.5220, Standard coef norm: 2.2608\n",
      "       Coefficient difference norm: 1.7411\n",
      "      ✔ Fold 5: MADL accuracy 0.875\n",
      "    📊 MADL CV Results: Accuracy 0.700±0.133\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0537]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0058\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0073\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 2.6555\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1354\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.6429, Standard intercept: -0.6972\n",
      "       MADL coef norm: 0.5229, Standard coef norm: 2.2494\n",
      "       Coefficient difference norm: 1.7305\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2347% cost\n",
      "    ✅ Logistic_MADL: Test Return=9.10%, Trades=22\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.713±0.094\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2347% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=25.56%, Trades=32\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.500\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.700±0.127\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1970% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2363% cost\n",
      "    ✅ RandomForest_Standard: Test Return=42.68%, Trades=38\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.094\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1970% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2363% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=46.37%, Trades=31\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.083\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1970% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2363% cost\n",
      "    ✅ Neural_Standard: Test Return=23.42%, Trades=30\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.064\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1933% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2347% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2318% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=20.06%, Trades=21\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.875\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.083\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1868% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1972% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2376% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2366% cost\n",
      "    ✅ XGBoost_Standard: Test Return=35.14%, Trades=39\n",
      "\n",
      "💱 Processing CNY_USD...\n",
      "    ✅ CNY_USD: Total=262 days, Train=196 days, Test=66 days\n",
      "       📅 Train: 2020-03-11 to 2020-12-09\n",
      "       📅 Test:  2020-12-10 to 2021-03-11\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 253 rows\n",
      "    ✔ Loaded 13w_tbill: 253 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=6.31%, Test=0.77%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.812\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.762±0.073\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2038% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2009% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1960% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1939% cost\n",
      "    ✅ Logistic_Standard: Test Return=0.81%, Trades=2\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0083]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0026\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0021\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.3513\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0686\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3328, Standard intercept: -0.3785\n",
      "       MADL coef norm: 1.2510, Standard coef norm: 1.6274\n",
      "       Coefficient difference norm: 0.3765\n",
      "      ✔ Fold 1: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0083]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0022\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0018\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 2.1211\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1080\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1865, Standard intercept: -0.1705\n",
      "       MADL coef norm: 1.5554, Standard coef norm: 2.0220\n",
      "       Coefficient difference norm: 0.4666\n",
      "      ✔ Fold 2: MADL accuracy 0.812\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0083]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0017\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.6875\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0863\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0590, Standard intercept: -0.0109\n",
      "       MADL coef norm: 1.4757, Standard coef norm: 1.9302\n",
      "       Coefficient difference norm: 0.4547\n",
      "      ✔ Fold 3: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0083]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0017\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.9007\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0969\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2428, Standard intercept: 0.2489\n",
      "       MADL coef norm: 1.4884, Standard coef norm: 1.9369\n",
      "       Coefficient difference norm: 0.4484\n",
      "      ✔ Fold 4: MADL accuracy 0.875\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0143]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0005, Total Loss = 2.0216\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1031\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2565, Standard intercept: 0.2804\n",
      "       MADL coef norm: 1.5193, Standard coef norm: 1.9755\n",
      "       Coefficient difference norm: 0.4564\n",
      "      ✔ Fold 5: MADL accuracy 0.750\n",
      "    📊 MADL CV Results: Accuracy 0.762±0.073\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0143]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 2.0051\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1022\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2980, Standard intercept: 0.2523\n",
      "       MADL coef norm: 1.5192, Standard coef norm: 1.9757\n",
      "       Coefficient difference norm: 0.4566\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ Logistic_MADL: Test Return=-5.92%, Trades=42\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.625\n",
      "      ✔ Fold 5: Accuracy accuracy 0.625\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.092\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-8.04%, Trades=37\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.750\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.025\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-7.20%, Trades=38\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.812\n",
      "      ✔ Fold 4: Accuracy accuracy 0.750\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.061\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-5.02%, Trades=36\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.700±0.083\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ Neural_Standard: Test Return=-5.68%, Trades=41\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.812\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.812\n",
      "    📊 Accuracy CV Results: Accuracy 0.750±0.079\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1957% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1958% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-0.17%, Trades=19\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.750\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.713±0.031\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-5.71%, Trades=37\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=194, test=64\n",
      "  📈 Buy-and-hold benchmark: Train=6.31%, Test=0.77%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.625\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.725±0.064\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1966% cost\n",
      "    ✅ Logistic_Standard: Test Return=-4.01%, Trades=40\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0083]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0026\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0021\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.7467\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0885\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4674, Standard intercept: -0.4837\n",
      "       MADL coef norm: 1.3973, Standard coef norm: 1.8158\n",
      "       Coefficient difference norm: 0.4190\n",
      "      ✔ Fold 1: MADL accuracy 0.625\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0083]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0022\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0018\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 2.4212\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1236\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2366, Standard intercept: -0.2234\n",
      "       MADL coef norm: 1.6599, Standard coef norm: 2.1590\n",
      "       Coefficient difference norm: 0.4996\n",
      "      ✔ Fold 2: MADL accuracy 0.562\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0083]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0017\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.7735\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0905\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0556, Standard intercept: -0.0722\n",
      "       MADL coef norm: 1.5295, Standard coef norm: 2.0049\n",
      "       Coefficient difference norm: 0.4762\n",
      "      ✔ Fold 3: MADL accuracy 0.688\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0083]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0017\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 2.0629\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1053\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2115, Standard intercept: 0.1835\n",
      "       MADL coef norm: 1.5324, Standard coef norm: 1.9938\n",
      "       Coefficient difference norm: 0.4620\n",
      "      ✔ Fold 4: MADL accuracy 0.875\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0143]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 2.1226\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1082\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2596, Standard intercept: 0.2339\n",
      "       MADL coef norm: 1.5534, Standard coef norm: 2.0196\n",
      "       Coefficient difference norm: 0.4664\n",
      "      ✔ Fold 5: MADL accuracy 0.750\n",
      "    📊 MADL CV Results: Accuracy 0.700±0.108\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0143]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 2.0777\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1059\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2426, Standard intercept: 0.2264\n",
      "       MADL coef norm: 1.5379, Standard coef norm: 2.0001\n",
      "       Coefficient difference norm: 0.4627\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1966% cost\n",
      "    ✅ Logistic_MADL: Test Return=-3.48%, Trades=39\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.500\n",
      "      ✔ Fold 3: Accuracy accuracy 0.625\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.109\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-7.87%, Trades=33\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.625\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.083\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-5.53%, Trades=39\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.750\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.100\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-7.25%, Trades=43\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.688\n",
      "      ✔ Fold 2: Accuracy accuracy 0.562\n",
      "      ✔ Fold 3: Accuracy accuracy 0.688\n",
      "      ✔ Fold 4: Accuracy accuracy 0.875\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.700±0.100\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1966% cost\n",
      "    ✅ Neural_Standard: Test Return=-6.77%, Trades=24\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.688\n",
      "      ✔ Fold 3: Accuracy accuracy 0.750\n",
      "      ✔ Fold 4: Accuracy accuracy 0.688\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.675±0.061\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1957% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1958% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-1.54%, Trades=26\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.562\n",
      "      ✔ Fold 2: Accuracy accuracy 0.500\n",
      "      ✔ Fold 3: Accuracy accuracy 0.562\n",
      "      ✔ Fold 4: Accuracy accuracy 0.812\n",
      "      ✔ Fold 5: Accuracy accuracy 0.688\n",
      "    📊 Accuracy CV Results: Accuracy 0.625±0.112\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2089% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2109% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1964% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-5.03%, Trades=40\n",
      "\n",
      "📊 Period 2 completed: 128 successful model runs\n",
      "\n",
      "📍 PERIOD 3: Training 2021-03-12 to 2023-12-31\n",
      "------------------------------------------------------------\n",
      "\n",
      "💱 Processing EUR_USD...\n",
      "    ✅ EUR_USD: Total=731 days, Train=548 days, Test=183 days\n",
      "       📅 Train: 2021-03-12 to 2023-04-18\n",
      "       📅 Test:  2023-04-19 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 706 rows\n",
      "    ✔ Loaded 13w_tbill: 706 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-8.45%, Test=0.61%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.822\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.724±0.065\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0111% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    ✅ Logistic_Standard: Test Return=9.88%, Trades=17\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0108]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0023\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.6625\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0846\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1825, Standard intercept: 0.1368\n",
      "       MADL coef norm: 1.3647, Standard coef norm: 1.7724\n",
      "       Coefficient difference norm: 0.4077\n",
      "      ✔ Fold 1: MADL accuracy 0.689\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0108]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0027\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0022\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.2683\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0647\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2904, Standard intercept: -0.2743\n",
      "       MADL coef norm: 1.2081, Standard coef norm: 1.5712\n",
      "       Coefficient difference norm: 0.3633\n",
      "      ✔ Fold 2: MADL accuracy 0.622\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0164]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.3051\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0666\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2437, Standard intercept: -0.1956\n",
      "       MADL coef norm: 1.3053, Standard coef norm: 1.7084\n",
      "       Coefficient difference norm: 0.4033\n",
      "      ✔ Fold 3: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0164]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0035\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0030\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.4344\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0728\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2405, Standard intercept: -0.2344\n",
      "       MADL coef norm: 1.2920, Standard coef norm: 1.6810\n",
      "       Coefficient difference norm: 0.3891\n",
      "      ✔ Fold 4: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0218]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.8364\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0933\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0867, Standard intercept: -0.0628\n",
      "       MADL coef norm: 1.4315, Standard coef norm: 1.8592\n",
      "       Coefficient difference norm: 0.4279\n",
      "      ✔ Fold 5: MADL accuracy 0.778\n",
      "    📊 MADL CV Results: Accuracy 0.720±0.064\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0218]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.7335\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0880\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0300, Standard intercept: -0.0157\n",
      "       MADL coef norm: 1.4029, Standard coef norm: 1.8232\n",
      "       Coefficient difference norm: 0.4203\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ Logistic_MADL: Test Return=82.07%, Trades=117\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.578\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.689\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.676±0.061\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=58.85%, Trades=105\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.724±0.048\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ RandomForest_Standard: Test Return=78.99%, Trades=105\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.667\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.716±0.036\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=55.84%, Trades=105\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.778\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.062\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ Neural_Standard: Test Return=81.49%, Trades=107\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.716±0.051\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0111% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=10.08%, Trades=19\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.733±0.037\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ XGBoost_Standard: Test Return=77.21%, Trades=127\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-8.45%, Test=0.61%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.778\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.054\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ Logistic_Standard: Test Return=86.54%, Trades=110\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0108]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0023\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 2.2333\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1136\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1869, Standard intercept: 0.1706\n",
      "       MADL coef norm: 1.5713, Standard coef norm: 2.0405\n",
      "       Coefficient difference norm: 0.4696\n",
      "      ✔ Fold 1: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0108]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0027\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0022\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.3027\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0664\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2988, Standard intercept: -0.2856\n",
      "       MADL coef norm: 1.2137, Standard coef norm: 1.5792\n",
      "       Coefficient difference norm: 0.3661\n",
      "      ✔ Fold 2: MADL accuracy 0.622\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0164]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5688\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0798\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1681, Standard intercept: -0.1847\n",
      "       MADL coef norm: 1.3751, Standard coef norm: 1.7959\n",
      "       Coefficient difference norm: 0.4218\n",
      "      ✔ Fold 3: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0164]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0035\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0030\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5430\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0783\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2025, Standard intercept: -0.2305\n",
      "       MADL coef norm: 1.3099, Standard coef norm: 1.7029\n",
      "       Coefficient difference norm: 0.3937\n",
      "      ✔ Fold 4: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0218]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.8529\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0942\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0472, Standard intercept: -0.0729\n",
      "       MADL coef norm: 1.4380, Standard coef norm: 1.8679\n",
      "       Coefficient difference norm: 0.4302\n",
      "      ✔ Fold 5: MADL accuracy 0.778\n",
      "    📊 MADL CV Results: Accuracy 0.716±0.053\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0218]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.7898\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0908\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0100, Standard intercept: -0.0263\n",
      "       MADL coef norm: 1.4073, Standard coef norm: 1.8278\n",
      "       Coefficient difference norm: 0.4210\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ Logistic_MADL: Test Return=86.15%, Trades=111\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.533\n",
      "      ✔ Fold 2: Accuracy accuracy 0.467\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.644±0.120\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=82.64%, Trades=114\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.489\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.698±0.105\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ RandomForest_Standard: Test Return=56.07%, Trades=110\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.444\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.684±0.122\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=85.50%, Trades=113\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.489\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.667\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.644±0.083\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ Neural_Standard: Test Return=69.55%, Trades=100\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.707±0.026\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0099% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=16.94%, Trades=28\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.556\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.644\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.081\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0101% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0110% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0109% cost\n",
      "    ✅ XGBoost_Standard: Test Return=82.77%, Trades=108\n",
      "\n",
      "💱 Processing JPY_USD...\n",
      "    ✅ JPY_USD: Total=731 days, Train=548 days, Test=183 days\n",
      "       📅 Train: 2021-03-12 to 2023-04-18\n",
      "       📅 Test:  2023-04-19 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 706 rows\n",
      "    ✔ Loaded 13w_tbill: 706 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-19.10%, Test=-4.94%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.778\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.751±0.026\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1636% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2006% cost\n",
      "    ✅ Logistic_Standard: Test Return=73.63%, Trades=83\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0098]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0026\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.3739\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0707\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5608, Standard intercept: 0.5151\n",
      "       MADL coef norm: 1.2351, Standard coef norm: 1.6034\n",
      "       Coefficient difference norm: 0.3683\n",
      "      ✔ Fold 1: MADL accuracy 0.733\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0100]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0027\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.3990\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0710\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0059, Standard intercept: 0.0220\n",
      "       MADL coef norm: 1.2586, Standard coef norm: 1.6357\n",
      "       Coefficient difference norm: 0.3771\n",
      "      ✔ Fold 2: MADL accuracy 0.733\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0179]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.5815\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0806\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2119, Standard intercept: -0.1637\n",
      "       MADL coef norm: 1.4176, Standard coef norm: 1.8530\n",
      "       Coefficient difference norm: 0.4356\n",
      "      ✔ Fold 3: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0192]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0035\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.6376\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0834\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4518, Standard intercept: -0.4456\n",
      "       MADL coef norm: 1.3879, Standard coef norm: 1.8068\n",
      "       Coefficient difference norm: 0.4189\n",
      "      ✔ Fold 4: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0385]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 2.2321\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1139\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4224, Standard intercept: -0.3984\n",
      "       MADL coef norm: 1.5978, Standard coef norm: 2.0777\n",
      "       Coefficient difference norm: 0.4800\n",
      "      ✔ Fold 5: MADL accuracy 0.711\n",
      "    📊 MADL CV Results: Accuracy 0.747±0.030\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0392]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0043\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0045\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 2.0630\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1046\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3045, Standard intercept: -0.3502\n",
      "       MADL coef norm: 1.5302, Standard coef norm: 1.9886\n",
      "       Coefficient difference norm: 0.4584\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1636% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2006% cost\n",
      "    ✅ Logistic_MADL: Test Return=69.59%, Trades=88\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.644\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.698±0.036\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1633% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2006% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=47.17%, Trades=99\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.689\n",
      "    📊 Accuracy CV Results: Accuracy 0.729±0.043\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1633% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2007% cost\n",
      "    ✅ RandomForest_Standard: Test Return=53.54%, Trades=92\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.667\n",
      "      ✔ Fold 2: Accuracy accuracy 0.578\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.689±0.066\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1636% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2015% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=68.82%, Trades=90\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.702±0.046\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1636% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2017% cost\n",
      "    ✅ Neural_Standard: Test Return=67.46%, Trades=90\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.622\n",
      "    📊 Accuracy CV Results: Accuracy 0.644±0.040\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1630% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1646% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2010% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2063% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=16.79%, Trades=36\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.689\n",
      "    📊 Accuracy CV Results: Accuracy 0.707±0.049\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1636% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2015% cost\n",
      "    ✅ XGBoost_Standard: Test Return=69.24%, Trades=93\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-19.10%, Test=-4.94%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.822\n",
      "      ✔ Fold 2: Accuracy accuracy 0.644\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.747±0.064\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1633% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2006% cost\n",
      "    ✅ Logistic_Standard: Test Return=70.74%, Trades=90\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0098]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0026\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.3584\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0698\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5229, Standard intercept: 0.5066\n",
      "       MADL coef norm: 1.2195, Standard coef norm: 1.5835\n",
      "       Coefficient difference norm: 0.3646\n",
      "      ✔ Fold 1: MADL accuracy 0.822\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0100]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0027\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.2160\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0616\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0112, Standard intercept: 0.0243\n",
      "       MADL coef norm: 1.2012, Standard coef norm: 1.5667\n",
      "       Coefficient difference norm: 0.3661\n",
      "      ✔ Fold 2: MADL accuracy 0.644\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0179]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.6763\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0853\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1376, Standard intercept: -0.1542\n",
      "       MADL coef norm: 1.4073, Standard coef norm: 1.8360\n",
      "       Coefficient difference norm: 0.4297\n",
      "      ✔ Fold 3: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0192]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0035\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.5867\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0805\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3934, Standard intercept: -0.4215\n",
      "       MADL coef norm: 1.3201, Standard coef norm: 1.7150\n",
      "       Coefficient difference norm: 0.3956\n",
      "      ✔ Fold 4: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0385]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 2.1154\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1075\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3614, Standard intercept: -0.3872\n",
      "       MADL coef norm: 1.5412, Standard coef norm: 2.0025\n",
      "       Coefficient difference norm: 0.4615\n",
      "      ✔ Fold 5: MADL accuracy 0.711\n",
      "    📊 MADL CV Results: Accuracy 0.747±0.064\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0392]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0043\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0045\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.7779\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0902\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3250, Standard intercept: -0.3413\n",
      "       MADL coef norm: 1.4248, Standard coef norm: 1.8536\n",
      "       Coefficient difference norm: 0.4292\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1636% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2006% cost\n",
      "    ✅ Logistic_MADL: Test Return=69.56%, Trades=91\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.667\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.667\n",
      "      ✔ Fold 5: Accuracy accuracy 0.578\n",
      "    📊 Accuracy CV Results: Accuracy 0.676±0.071\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1636% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1633% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2015% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=71.53%, Trades=79\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.724±0.048\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1636% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1633% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2015% cost\n",
      "    ✅ RandomForest_Standard: Test Return=31.42%, Trades=101\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.644\n",
      "      ✔ Fold 3: Accuracy accuracy 0.822\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.600\n",
      "    📊 Accuracy CV Results: Accuracy 0.707±0.077\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1633% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2015% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=51.95%, Trades=96\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.667\n",
      "      ✔ Fold 5: Accuracy accuracy 0.600\n",
      "    📊 Accuracy CV Results: Accuracy 0.684±0.062\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1633% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2015% cost\n",
      "    ✅ Neural_Standard: Test Return=28.78%, Trades=93\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.644\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.622\n",
      "    📊 Accuracy CV Results: Accuracy 0.698±0.056\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1660% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1647% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2010% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2049% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=16.71%, Trades=41\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.061\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1637% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1633% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2020% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2015% cost\n",
      "    ✅ XGBoost_Standard: Test Return=59.77%, Trades=97\n",
      "\n",
      "💱 Processing AUD_USD...\n",
      "    ✅ AUD_USD: Total=730 days, Train=547 days, Test=183 days\n",
      "       📅 Train: 2021-03-12 to 2023-04-17\n",
      "       📅 Test:  2023-04-18 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 706 rows\n",
      "    ✔ Loaded 13w_tbill: 706 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=545, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-13.96%, Test=1.64%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.622\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.055\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0263% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0296% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0299% cost\n",
      "    ✅ Logistic_Standard: Test Return=16.53%, Trades=16\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0163]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0045\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 1.1450\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0572\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4711, Standard intercept: -0.5168\n",
      "       MADL coef norm: 1.1275, Standard coef norm: 1.4637\n",
      "       Coefficient difference norm: 0.3362\n",
      "      ✔ Fold 1: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0163]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0043\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0030\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.1807\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0593\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3212, Standard intercept: -0.3051\n",
      "       MADL coef norm: 1.1671, Standard coef norm: 1.5181\n",
      "       Coefficient difference norm: 0.3511\n",
      "      ✔ Fold 2: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0163]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0046\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 1.2071\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0604\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1989, Standard intercept: -0.1508\n",
      "       MADL coef norm: 1.2405, Standard coef norm: 1.6219\n",
      "       Coefficient difference norm: 0.3817\n",
      "      ✔ Fold 3: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0228]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0050\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.1728\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0588\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1668, Standard intercept: -0.1606\n",
      "       MADL coef norm: 1.1705, Standard coef norm: 1.5232\n",
      "       Coefficient difference norm: 0.3528\n",
      "      ✔ Fold 4: MADL accuracy 0.622\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0293]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0045\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.3288\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0668\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2211, Standard intercept: -0.1971\n",
      "       MADL coef norm: 1.2069, Standard coef norm: 1.5662\n",
      "       Coefficient difference norm: 0.3595\n",
      "      ✔ Fold 5: MADL accuracy 0.622\n",
      "    📊 MADL CV Results: Accuracy 0.693±0.060\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0293]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0046\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.2686\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0642\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0459, Standard intercept: -0.0916\n",
      "       MADL coef norm: 1.1927, Standard coef norm: 1.5491\n",
      "       Coefficient difference norm: 0.3565\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    ✅ Logistic_MADL: Test Return=134.13%, Trades=107\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.644\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.644\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.671±0.043\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0257% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=82.69%, Trades=122\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.778\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.684±0.071\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0257% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    ✅ RandomForest_Standard: Test Return=120.69%, Trades=103\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.644\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.033\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0257% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=111.40%, Trades=117\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.778\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.644\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.707±0.060\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    ✅ Neural_Standard: Test Return=138.32%, Trades=100\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.644\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.684±0.051\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0263% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0299% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=10.49%, Trades=12\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.689\n",
      "    📊 Accuracy CV Results: Accuracy 0.702±0.036\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0257% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    ✅ XGBoost_Standard: Test Return=131.91%, Trades=99\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=545, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-13.96%, Test=1.64%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.622\n",
      "      ✔ Fold 4: Accuracy accuracy 0.644\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.649±0.022\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    ✅ Logistic_Standard: Test Return=144.05%, Trades=103\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0163]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0045\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 1.4298\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0719\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5047, Standard intercept: -0.5210\n",
      "       MADL coef norm: 1.2440, Standard coef norm: 1.6142\n",
      "       Coefficient difference norm: 0.3707\n",
      "      ✔ Fold 1: MADL accuracy 0.667\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0163]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0043\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0030\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.3965\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0701\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3202, Standard intercept: -0.3071\n",
      "       MADL coef norm: 1.2280, Standard coef norm: 1.5939\n",
      "       Coefficient difference norm: 0.3665\n",
      "      ✔ Fold 2: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0163]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0046\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.2504\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0624\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1459, Standard intercept: -0.1626\n",
      "       MADL coef norm: 1.2461, Standard coef norm: 1.6303\n",
      "       Coefficient difference norm: 0.3854\n",
      "      ✔ Fold 3: MADL accuracy 0.667\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0228]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0050\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.2977\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0653\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1512, Standard intercept: -0.1793\n",
      "       MADL coef norm: 1.2133, Standard coef norm: 1.5793\n",
      "       Coefficient difference norm: 0.3668\n",
      "      ✔ Fold 4: MADL accuracy 0.644\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0293]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0045\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.3899\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0698\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1764, Standard intercept: -0.2021\n",
      "       MADL coef norm: 1.2371, Standard coef norm: 1.6061\n",
      "       Coefficient difference norm: 0.3692\n",
      "      ✔ Fold 5: MADL accuracy 0.622\n",
      "    📊 MADL CV Results: Accuracy 0.662±0.029\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0293]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0046\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.3320\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0673\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0819, Standard intercept: -0.0981\n",
      "       MADL coef norm: 1.2036, Standard coef norm: 1.5624\n",
      "       Coefficient difference norm: 0.3593\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    ✅ Logistic_MADL: Test Return=141.21%, Trades=106\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.511\n",
      "      ✔ Fold 2: Accuracy accuracy 0.578\n",
      "      ✔ Fold 3: Accuracy accuracy 0.578\n",
      "      ✔ Fold 4: Accuracy accuracy 0.578\n",
      "      ✔ Fold 5: Accuracy accuracy 0.622\n",
      "    📊 Accuracy CV Results: Accuracy 0.573±0.036\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=66.93%, Trades=106\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.667\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.444\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.644±0.107\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    ✅ RandomForest_Standard: Test Return=78.81%, Trades=114\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.578\n",
      "      ✔ Fold 2: Accuracy accuracy 0.778\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.578\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.081\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=76.96%, Trades=81\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.556\n",
      "      ✔ Fold 4: Accuracy accuracy 0.467\n",
      "      ✔ Fold 5: Accuracy accuracy 0.578\n",
      "    📊 Accuracy CV Results: Accuracy 0.578±0.072\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    ✅ Neural_Standard: Test Return=93.62%, Trades=108\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.556\n",
      "      ✔ Fold 5: Accuracy accuracy 0.600\n",
      "    📊 Accuracy CV Results: Accuracy 0.640±0.063\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0262% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0259% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0291% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0291% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=9.59%, Trades=20\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.622\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.684±0.062\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0258% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0257% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0298% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0297% cost\n",
      "    ✅ XGBoost_Standard: Test Return=98.06%, Trades=117\n",
      "\n",
      "💱 Processing CHF_USD...\n",
      "    ✅ CHF_USD: Total=731 days, Train=548 days, Test=183 days\n",
      "       📅 Train: 2021-03-12 to 2023-04-18\n",
      "       📅 Test:  2023-04-19 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 706 rows\n",
      "    ✔ Loaded 13w_tbill: 706 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=3.08%, Test=6.51%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.778\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.760±0.026\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ Logistic_Standard: Test Return=79.66%, Trades=108\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0120]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0004, Total Loss = 1.2379\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0633\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2526, Standard intercept: -0.2983\n",
      "       MADL coef norm: 1.1721, Standard coef norm: 1.5216\n",
      "       Coefficient difference norm: 0.3495\n",
      "      ✔ Fold 1: MADL accuracy 0.778\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0120]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.2169\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0617\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1263, Standard intercept: -0.1103\n",
      "       MADL coef norm: 1.1812, Standard coef norm: 1.5361\n",
      "       Coefficient difference norm: 0.3549\n",
      "      ✔ Fold 2: MADL accuracy 0.733\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0120]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.2480\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0633\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1043, Standard intercept: -0.0561\n",
      "       MADL coef norm: 1.2517, Standard coef norm: 1.6355\n",
      "       Coefficient difference norm: 0.3841\n",
      "      ✔ Fold 3: MADL accuracy 0.733\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0302]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0035\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0030\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5597\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0793\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0977, Standard intercept: -0.0916\n",
      "       MADL coef norm: 1.3527, Standard coef norm: 1.7607\n",
      "       Coefficient difference norm: 0.4081\n",
      "      ✔ Fold 4: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0302]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0038\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.8522\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0941\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0664, Standard intercept: -0.0425\n",
      "       MADL coef norm: 1.4270, Standard coef norm: 1.8518\n",
      "       Coefficient difference norm: 0.4250\n",
      "      ✔ Fold 5: MADL accuracy 0.756\n",
      "    📊 MADL CV Results: Accuracy 0.760±0.026\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0302]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.6802\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0854\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0777, Standard intercept: 0.0320\n",
      "       MADL coef norm: 1.3761, Standard coef norm: 1.7878\n",
      "       Coefficient difference norm: 0.4117\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ Logistic_MADL: Test Return=83.71%, Trades=114\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.778\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.716±0.051\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=73.88%, Trades=85\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.778\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.773±0.017\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ RandomForest_Standard: Test Return=79.34%, Trades=102\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.778\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.778\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.769±0.011\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=84.92%, Trades=106\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.011\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ Neural_Standard: Test Return=84.59%, Trades=105\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.667\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.711±0.028\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0234% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0221% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=12.49%, Trades=26\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.844\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.778\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.778±0.034\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ XGBoost_Standard: Test Return=81.02%, Trades=106\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=3.08%, Test=6.51%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.667\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.689\n",
      "      ✔ Fold 5: Accuracy accuracy 0.778\n",
      "    📊 Accuracy CV Results: Accuracy 0.729±0.051\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ Logistic_Standard: Test Return=83.11%, Trades=110\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0120]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.5496\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0787\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2891, Standard intercept: -0.3054\n",
      "       MADL coef norm: 1.3051, Standard coef norm: 1.6949\n",
      "       Coefficient difference norm: 0.3902\n",
      "      ✔ Fold 1: MADL accuracy 0.622\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0120]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.3558\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0691\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1168, Standard intercept: -0.1037\n",
      "       MADL coef norm: 1.2410, Standard coef norm: 1.6150\n",
      "       Coefficient difference norm: 0.3746\n",
      "      ✔ Fold 2: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0120]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.3685\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0697\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0310, Standard intercept: -0.0477\n",
      "       MADL coef norm: 1.2817, Standard coef norm: 1.6741\n",
      "       Coefficient difference norm: 0.3935\n",
      "      ✔ Fold 3: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0302]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0035\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0030\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.7386\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0884\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0610, Standard intercept: -0.0891\n",
      "       MADL coef norm: 1.3928, Standard coef norm: 1.8107\n",
      "       Coefficient difference norm: 0.4186\n",
      "      ✔ Fold 4: MADL accuracy 0.689\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0302]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0038\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0034\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.9016\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0966\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0060, Standard intercept: -0.0317\n",
      "       MADL coef norm: 1.4386, Standard coef norm: 1.8662\n",
      "       Coefficient difference norm: 0.4279\n",
      "      ✔ Fold 5: MADL accuracy 0.778\n",
      "    📊 MADL CV Results: Accuracy 0.720±0.064\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0302]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0039\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.7210\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0872\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0610, Standard intercept: 0.0447\n",
      "       MADL coef norm: 1.3881, Standard coef norm: 1.8041\n",
      "       Coefficient difference norm: 0.4165\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ Logistic_MADL: Test Return=79.19%, Trades=115\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.822\n",
      "      ✔ Fold 3: Accuracy accuracy 0.622\n",
      "      ✔ Fold 4: Accuracy accuracy 0.444\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.689±0.141\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0222% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=70.40%, Trades=90\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.644\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.644\n",
      "      ✔ Fold 5: Accuracy accuracy 0.778\n",
      "    📊 Accuracy CV Results: Accuracy 0.716±0.060\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ RandomForest_Standard: Test Return=43.91%, Trades=87\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.533\n",
      "      ✔ Fold 5: Accuracy accuracy 0.622\n",
      "    📊 Accuracy CV Results: Accuracy 0.676±0.085\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=63.50%, Trades=93\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.511\n",
      "      ✔ Fold 3: Accuracy accuracy 0.644\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.622±0.066\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ Neural_Standard: Test Return=57.83%, Trades=98\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.533\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.511\n",
      "      ✔ Fold 5: Accuracy accuracy 0.511\n",
      "    📊 Accuracy CV Results: Accuracy 0.587±0.094\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0234% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0221% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=13.69%, Trades=27\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.778\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.742±0.023\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0232% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0231% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0225% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0223% cost\n",
      "    ✅ XGBoost_Standard: Test Return=80.12%, Trades=104\n",
      "\n",
      "💱 Processing MXN_USD...\n",
      "    ✅ MXN_USD: Total=731 days, Train=548 days, Test=183 days\n",
      "       📅 Train: 2021-03-12 to 2023-04-18\n",
      "       📅 Test:  2023-04-19 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 706 rows\n",
      "    ✔ Loaded 13w_tbill: 706 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=14.20%, Test=6.32%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.822\n",
      "    📊 Accuracy CV Results: Accuracy 0.747±0.046\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7198% cost\n",
      "    ✅ Logistic_Standard: Test Return=-21.93%, Trades=102\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0185]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0052\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0020, Total Loss = 2.0321\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1029\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3589, Standard intercept: 0.3132\n",
      "       MADL coef norm: 1.5139, Standard coef norm: 1.9668\n",
      "       Coefficient difference norm: 0.4529\n",
      "      ✔ Fold 1: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0185]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0047\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0038\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0021, Total Loss = 2.1945\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1108\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1381, Standard intercept: 0.1542\n",
      "       MADL coef norm: 1.5998, Standard coef norm: 2.0818\n",
      "       Coefficient difference norm: 0.4822\n",
      "      ✔ Fold 2: MADL accuracy 0.689\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0229]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0047\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 2.4174\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1228\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4122, Standard intercept: 0.4604\n",
      "       MADL coef norm: 1.7232, Standard coef norm: 2.2486\n",
      "       Coefficient difference norm: 0.5256\n",
      "      ✔ Fold 3: MADL accuracy 0.689\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0240]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0049\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0042\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 2.3994\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1220\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3300, Standard intercept: 0.3361\n",
      "       MADL coef norm: 1.6766, Standard coef norm: 2.1821\n",
      "       Coefficient difference norm: 0.5056\n",
      "      ✔ Fold 4: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0240]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0048\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 2.2106\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1122\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3448, Standard intercept: 0.3688\n",
      "       MADL coef norm: 1.5645, Standard coef norm: 2.0310\n",
      "       Coefficient difference norm: 0.4666\n",
      "      ✔ Fold 5: MADL accuracy 0.844\n",
      "    📊 MADL CV Results: Accuracy 0.738±0.059\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0248]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0049\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0042\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 1.9513\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0992\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4687, Standard intercept: 0.4230\n",
      "       MADL coef norm: 1.4891, Standard coef norm: 1.9353\n",
      "       Coefficient difference norm: 0.4462\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7198% cost\n",
      "    ✅ Logistic_MADL: Test Return=-11.36%, Trades=96\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.778\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.711±0.044\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7205% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-32.01%, Trades=95\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.822\n",
      "    📊 Accuracy CV Results: Accuracy 0.742±0.044\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7205% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-17.17%, Trades=93\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.043\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7205% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-22.52%, Trades=102\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.644\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.822\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.059\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7198% cost\n",
      "    ✅ Neural_Standard: Test Return=-23.25%, Trades=101\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.644\n",
      "      ✔ Fold 4: Accuracy accuracy 0.778\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.698±0.067\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8244% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.6809% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.6899% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=5.42%, Trades=29\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.702±0.041\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7205% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-23.04%, Trades=105\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=14.20%, Test=6.32%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.778\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.036\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7198% cost\n",
      "    ✅ Logistic_Standard: Test Return=3.30%, Trades=78\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0185]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0052\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0023, Total Loss = 2.0770\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1053\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3344, Standard intercept: 0.3181\n",
      "       MADL coef norm: 1.5174, Standard coef norm: 1.9708\n",
      "       Coefficient difference norm: 0.4538\n",
      "      ✔ Fold 1: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0185]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0047\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0038\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0022, Total Loss = 2.3551\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1195\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1435, Standard intercept: 0.1566\n",
      "       MADL coef norm: 1.6549, Standard coef norm: 2.1548\n",
      "       Coefficient difference norm: 0.5004\n",
      "      ✔ Fold 2: MADL accuracy 0.733\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0229]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0047\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0016, Total Loss = 2.4779\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1263\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.5117, Standard intercept: 0.4562\n",
      "       MADL coef norm: 0.5051, Standard coef norm: 2.2501\n",
      "       Coefficient difference norm: 1.7547\n",
      "      ✔ Fold 3: MADL accuracy 0.689\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0240]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0049\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0042\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 2.5788\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1313\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4356, Standard intercept: 0.3421\n",
      "       MADL coef norm: 0.5153, Standard coef norm: 2.2380\n",
      "       Coefficient difference norm: 1.7290\n",
      "      ✔ Fold 4: MADL accuracy 0.644\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0240]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0048\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0016, Total Loss = 2.3207\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1181\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3988, Standard intercept: 0.3731\n",
      "       MADL coef norm: 1.6016, Standard coef norm: 2.0792\n",
      "       Coefficient difference norm: 0.4778\n",
      "      ✔ Fold 5: MADL accuracy 0.778\n",
      "    📊 MADL CV Results: Accuracy 0.711±0.044\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0248]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0049\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0042\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 2.0289\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1029\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.4443, Standard intercept: 0.4281\n",
      "       MADL coef norm: 1.5016, Standard coef norm: 1.9506\n",
      "       Coefficient difference norm: 0.4494\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7201% cost\n",
      "    ✅ Logistic_MADL: Test Return=16.34%, Trades=74\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.716±0.036\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7205% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-16.47%, Trades=88\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.600\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.698±0.064\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7205% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7201% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-66.12%, Trades=105\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.716±0.045\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7205% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-5.14%, Trades=105\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.511\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.533\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.604±0.074\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7201% cost\n",
      "    ✅ Neural_Standard: Test Return=-17.03%, Trades=88\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.511\n",
      "      ✔ Fold 2: Accuracy accuracy 0.578\n",
      "      ✔ Fold 3: Accuracy accuracy 0.600\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.631±0.088\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8244% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7198% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-16.56%, Trades=5\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.698±0.036\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8268% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8161% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7227% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7205% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-5.55%, Trades=104\n",
      "\n",
      "💱 Processing ZAR_USD...\n",
      "    ✅ ZAR_USD: Total=730 days, Train=547 days, Test=183 days\n",
      "       📅 Train: 2021-03-12 to 2023-04-18\n",
      "       📅 Test:  2023-04-19 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 706 rows\n",
      "    ✔ Loaded 13w_tbill: 706 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=545, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-18.63%, Test=0.00%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.778\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.029\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ Logistic_Standard: Test Return=37.40%, Trades=88\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0226]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0069\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0049\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0026, Total Loss = 1.4233\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0706\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2392, Standard intercept: -0.2849\n",
      "       MADL coef norm: 1.2694, Standard coef norm: 1.6494\n",
      "       Coefficient difference norm: 0.3801\n",
      "      ✔ Fold 1: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0227]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0072\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0048\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0027, Total Loss = 1.8130\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0902\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3395, Standard intercept: -0.3234\n",
      "       MADL coef norm: 1.4380, Standard coef norm: 1.8692\n",
      "       Coefficient difference norm: 0.4313\n",
      "      ✔ Fold 2: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0230]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0075\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0052\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0028, Total Loss = 1.4573\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0723\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2414, Standard intercept: 0.2895\n",
      "       MADL coef norm: 1.3852, Standard coef norm: 1.8135\n",
      "       Coefficient difference norm: 0.4284\n",
      "      ✔ Fold 3: MADL accuracy 0.689\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0387]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0077\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0056\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0031, Total Loss = 1.4784\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0732\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0787, Standard intercept: -0.0726\n",
      "       MADL coef norm: 1.3101, Standard coef norm: 1.7043\n",
      "       Coefficient difference norm: 0.3942\n",
      "      ✔ Fold 4: MADL accuracy 0.733\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0387]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0078\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0057\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0026, Total Loss = 1.4425\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0722\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1842, Standard intercept: -0.1602\n",
      "       MADL coef norm: 1.2876, Standard coef norm: 1.6749\n",
      "       Coefficient difference norm: 0.3875\n",
      "      ✔ Fold 5: MADL accuracy 0.778\n",
      "    📊 MADL CV Results: Accuracy 0.733±0.031\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0387]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0077\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0058\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0023, Total Loss = 1.5431\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0770\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1290, Standard intercept: -0.1747\n",
      "       MADL coef norm: 1.3314, Standard coef norm: 1.7313\n",
      "       Coefficient difference norm: 0.3999\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ Logistic_MADL: Test Return=39.31%, Trades=93\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.644\n",
      "      ✔ Fold 4: Accuracy accuracy 0.600\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.051\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=13.67%, Trades=91\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.711±0.040\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5900% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ RandomForest_Standard: Test Return=18.71%, Trades=95\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.778\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.689\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.033\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5900% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=20.79%, Trades=91\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.778\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.026\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ Neural_Standard: Test Return=23.22%, Trades=93\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.600\n",
      "      ✔ Fold 4: Accuracy accuracy 0.689\n",
      "      ✔ Fold 5: Accuracy accuracy 0.778\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.057\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5658% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5789% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7707% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7952% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=2.26%, Trades=6\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.689\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.729±0.041\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ XGBoost_Standard: Test Return=23.33%, Trades=91\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=545, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-18.63%, Test=0.00%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.600\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.707±0.068\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ Logistic_Standard: Test Return=29.47%, Trades=90\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0226]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0069\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0049\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0028, Total Loss = 1.5178\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0749\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2974, Standard intercept: -0.3137\n",
      "       MADL coef norm: 1.3017, Standard coef norm: 1.6917\n",
      "       Coefficient difference norm: 0.3905\n",
      "      ✔ Fold 1: MADL accuracy 0.689\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0227]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0072\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0048\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 1.8859\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0942\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3414, Standard intercept: -0.3282\n",
      "       MADL coef norm: 1.4536, Standard coef norm: 1.8895\n",
      "       Coefficient difference norm: 0.4364\n",
      "      ✔ Fold 2: MADL accuracy 0.689\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0230]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0075\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0052\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0024, Total Loss = 1.4655\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0728\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3300, Standard intercept: 0.3134\n",
      "       MADL coef norm: 1.3757, Standard coef norm: 1.8022\n",
      "       Coefficient difference norm: 0.4275\n",
      "      ✔ Fold 3: MADL accuracy 0.622\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0387]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0077\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0056\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0027, Total Loss = 1.5644\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0780\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0303, Standard intercept: -0.0584\n",
      "       MADL coef norm: 1.3335, Standard coef norm: 1.7354\n",
      "       Coefficient difference norm: 0.4026\n",
      "      ✔ Fold 4: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0387]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0078\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0057\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0026, Total Loss = 1.4750\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0737\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1240, Standard intercept: -0.1497\n",
      "       MADL coef norm: 1.2963, Standard coef norm: 1.6857\n",
      "       Coefficient difference norm: 0.3897\n",
      "      ✔ Fold 5: MADL accuracy 0.800\n",
      "    📊 MADL CV Results: Accuracy 0.711±0.061\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0387]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0077\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0058\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0025, Total Loss = 1.5559\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0779\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1540, Standard intercept: -0.1703\n",
      "       MADL coef norm: 1.3290, Standard coef norm: 1.7286\n",
      "       Coefficient difference norm: 0.4001\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ Logistic_MADL: Test Return=27.15%, Trades=93\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.756\n",
      "      ✔ Fold 2: Accuracy accuracy 0.511\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.667\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.667±0.085\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=31.37%, Trades=100\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.311\n",
      "      ✔ Fold 3: Accuracy accuracy 0.556\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.844\n",
      "    📊 Accuracy CV Results: Accuracy 0.627±0.191\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5900% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ RandomForest_Standard: Test Return=20.87%, Trades=98\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.444\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.689\n",
      "    📊 Accuracy CV Results: Accuracy 0.658±0.111\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5900% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-0.07%, Trades=87\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.489\n",
      "      ✔ Fold 3: Accuracy accuracy 0.511\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.596±0.089\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ Neural_Standard: Test Return=-1.47%, Trades=94\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.400\n",
      "      ✔ Fold 3: Accuracy accuracy 0.533\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.613±0.128\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5658% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5789% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7286% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7366% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-17.02%, Trades=14\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.556\n",
      "      ✔ Fold 3: Accuracy accuracy 0.644\n",
      "      ✔ Fold 4: Accuracy accuracy 0.778\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.684±0.077\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6015% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5970% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7339% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.7233% cost\n",
      "    ✅ XGBoost_Standard: Test Return=21.32%, Trades=100\n",
      "\n",
      "💱 Processing TRY_USD...\n",
      "    ✅ TRY_USD: Total=731 days, Train=548 days, Test=183 days\n",
      "       📅 Train: 2021-03-12 to 2023-04-18\n",
      "       📅 Test:  2023-04-19 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 706 rows\n",
      "    ✔ Loaded 13w_tbill: 706 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-61.69%, Test=-34.25%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.667\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.822\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.751±0.057\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2273% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2268% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7114% cost\n",
      "    ✅ Logistic_Standard: Test Return=95.94%, Trades=15\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0708]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0075\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0084\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0024, Total Loss = 2.1099\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1072\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4759, Standard intercept: -0.5216\n",
      "       MADL coef norm: 1.5514, Standard coef norm: 2.0167\n",
      "       Coefficient difference norm: 0.4653\n",
      "      ✔ Fold 1: MADL accuracy 0.667\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1131]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0080\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0117\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0040, Total Loss = 3.4176\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1724\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.7756, Standard intercept: -0.7221\n",
      "       MADL coef norm: 0.5933, Standard coef norm: 2.5705\n",
      "       Coefficient difference norm: 1.9777\n",
      "      ✔ Fold 2: MADL accuracy 0.756\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0107\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0193\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0046, Total Loss = 4.1490\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.2100\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.9401, Standard intercept: -0.7796\n",
      "       MADL coef norm: 0.6537, Standard coef norm: 3.0019\n",
      "       Coefficient difference norm: 2.3493\n",
      "      ✔ Fold 3: MADL accuracy 0.822\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0092\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0171\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0036, Total Loss = 4.2780\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.2166\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.0347, Standard intercept: -1.0143\n",
      "       MADL coef norm: 0.6637, Standard coef norm: 2.9274\n",
      "       Coefficient difference norm: 2.2638\n",
      "      ✔ Fold 4: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0077\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0156\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 4.0738\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.2068\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.0616, Standard intercept: -0.9817\n",
      "       MADL coef norm: 0.6476, Standard coef norm: 2.8349\n",
      "       Coefficient difference norm: 2.1885\n",
      "      ✔ Fold 5: MADL accuracy 0.800\n",
      "    📊 MADL CV Results: Accuracy 0.769±0.056\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0065\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0145\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0024, Total Loss = 3.6287\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1845\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.9063, Standard intercept: -1.0586\n",
      "       MADL coef norm: 0.6112, Standard coef norm: 2.6501\n",
      "       Coefficient difference norm: 2.0391\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2273% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2254% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.8251% cost\n",
      "    ✅ Logistic_MADL: Test Return=124.04%, Trades=3\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.729±0.029\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2273% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2252% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7114% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=19.19%, Trades=62\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.724±0.027\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2273% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2204% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5866% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5902% cost\n",
      "    ✅ RandomForest_Standard: Test Return=19.79%, Trades=59\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.667\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.027\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2252% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2254% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7114% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=76.74%, Trades=33\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.667\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.822\n",
      "      ✔ Fold 5: Accuracy accuracy 0.778\n",
      "    📊 Accuracy CV Results: Accuracy 0.756±0.053\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2268% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2252% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7114% cost\n",
      "    ✅ Neural_Standard: Test Return=32.71%, Trades=50\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.667\n",
      "      ✔ Fold 2: Accuracy accuracy 0.822\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.622\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.711±0.067\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2172% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2344% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7077% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7172% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=6.76%, Trades=6\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.844\n",
      "    📊 Accuracy CV Results: Accuracy 0.742±0.056\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2252% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2254% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7114% cost\n",
      "    ✅ XGBoost_Standard: Test Return=77.73%, Trades=29\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-61.69%, Test=-34.25%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.578\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.729±0.092\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2268% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2252% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.8251% cost\n",
      "    ✅ Logistic_Standard: Test Return=120.93%, Trades=5\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0002, 0.0708]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0075\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0084\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0025, Total Loss = 2.2002\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1116\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5280, Standard intercept: -0.5443\n",
      "       MADL coef norm: 1.5841, Standard coef norm: 2.0604\n",
      "       Coefficient difference norm: 0.4767\n",
      "      ✔ Fold 1: MADL accuracy 0.578\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1131]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0080\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0117\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0042, Total Loss = 3.3790\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1706\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.7977, Standard intercept: -0.7538\n",
      "       MADL coef norm: 0.5900, Standard coef norm: 2.5459\n",
      "       Coefficient difference norm: 1.9604\n",
      "      ✔ Fold 2: MADL accuracy 0.778\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0107\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0193\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0046, Total Loss = 3.9649\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1997\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.7206, Standard intercept: -0.7761\n",
      "       MADL coef norm: 0.6390, Standard coef norm: 2.9062\n",
      "       Coefficient difference norm: 2.2743\n",
      "      ✔ Fold 3: MADL accuracy 0.822\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0092\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0171\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0038, Total Loss = 4.2996\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.2177\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.9455, Standard intercept: -1.0390\n",
      "       MADL coef norm: 0.6654, Standard coef norm: 2.9006\n",
      "       Coefficient difference norm: 2.2400\n",
      "      ✔ Fold 4: MADL accuracy 0.800\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0077\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0156\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 4.1849\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.2125\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.9214, Standard intercept: -1.0071\n",
      "       MADL coef norm: 0.6564, Standard coef norm: 2.8716\n",
      "       Coefficient difference norm: 2.2171\n",
      "      ✔ Fold 5: MADL accuracy 0.800\n",
      "    📊 MADL CV Results: Accuracy 0.756±0.090\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0065\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0145\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 3.9246\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1995\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -1.0501, Standard intercept: -1.1044\n",
      "       MADL coef norm: 0.6356, Standard coef norm: 2.7623\n",
      "       Coefficient difference norm: 2.1300\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2273% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.3866% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.8251% cost\n",
      "    ✅ Logistic_MADL: Test Return=124.04%, Trades=3\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.556\n",
      "      ✔ Fold 2: Accuracy accuracy 0.578\n",
      "      ✔ Fold 3: Accuracy accuracy 0.689\n",
      "      ✔ Fold 4: Accuracy accuracy 0.822\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.680±0.102\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2273% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2204% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5902% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=7.39%, Trades=57\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.733\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.822\n",
      "      ✔ Fold 5: Accuracy accuracy 0.800\n",
      "    📊 Accuracy CV Results: Accuracy 0.751±0.071\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2273% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2172% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7150% cost\n",
      "    ✅ RandomForest_Standard: Test Return=9.69%, Trades=55\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.724±0.059\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2252% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2254% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.8137% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=105.63%, Trades=9\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.600\n",
      "      ✔ Fold 2: Accuracy accuracy 0.689\n",
      "      ✔ Fold 3: Accuracy accuracy 0.822\n",
      "      ✔ Fold 4: Accuracy accuracy 0.778\n",
      "      ✔ Fold 5: Accuracy accuracy 0.511\n",
      "    📊 Accuracy CV Results: Accuracy 0.680±0.114\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2273% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2172% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5887% cost\n",
      "    ✅ Neural_Standard: Test Return=35.39%, Trades=46\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.800\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.051\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2172% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2344% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.7172% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=63.20%, Trades=21\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.844\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.733±0.074\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2252% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2204% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5872% cost\n",
      "    ✅ XGBoost_Standard: Test Return=120.10%, Trades=1\n",
      "\n",
      "💱 Processing CNY_USD...\n",
      "    ✅ CNY_USD: Total=731 days, Train=548 days, Test=183 days\n",
      "       📅 Train: 2021-03-12 to 2023-04-18\n",
      "       📅 Test:  2023-04-19 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 706 rows\n",
      "    ✔ Loaded 13w_tbill: 706 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-5.55%, Test=-3.13%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.778\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.844\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.756\n",
      "    📊 Accuracy CV Results: Accuracy 0.764±0.046\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ Logistic_Standard: Test Return=3.17%, Trades=100\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0079]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0013\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0013\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0005, Total Loss = 2.6857\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1376\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0992, Standard intercept: -0.0531\n",
      "       MADL coef norm: 0.5257, Standard coef norm: 2.2700\n",
      "       Coefficient difference norm: 1.7446\n",
      "      ✔ Fold 1: MADL accuracy 0.778\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0079]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0012\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0013\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0004, Total Loss = 2.3412\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1201\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2260, Standard intercept: 0.2420\n",
      "       MADL coef norm: 1.6491, Standard coef norm: 2.1458\n",
      "       Coefficient difference norm: 0.4967\n",
      "      ✔ Fold 2: MADL accuracy 0.733\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0079]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0012\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0012\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0003, Total Loss = 1.7970\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0921\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1170, Standard intercept: 0.1651\n",
      "       MADL coef norm: 1.5040, Standard coef norm: 1.9650\n",
      "       Coefficient difference norm: 0.4613\n",
      "      ✔ Fold 3: MADL accuracy 0.844\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0100]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0015\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0017\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0005, Total Loss = 2.6303\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1348\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0780, Standard intercept: -0.0575\n",
      "       MADL coef norm: 0.5202, Standard coef norm: 2.2792\n",
      "       Coefficient difference norm: 1.7591\n",
      "      ✔ Fold 4: MADL accuracy 0.778\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0166]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0022\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 2.7072\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1386\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2330, Standard intercept: -0.1531\n",
      "       MADL coef norm: 0.5278, Standard coef norm: 2.2651\n",
      "       Coefficient difference norm: 1.7387\n",
      "      ✔ Fold 5: MADL accuracy 0.667\n",
      "    📊 MADL CV Results: Accuracy 0.760±0.059\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0166]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0023\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 2.4020\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1229\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1122, Standard intercept: -0.1579\n",
      "       MADL coef norm: 1.6561, Standard coef norm: 2.1529\n",
      "       Coefficient difference norm: 0.4968\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ Logistic_MADL: Test Return=3.52%, Trades=100\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.733\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.733\n",
      "    📊 Accuracy CV Results: Accuracy 0.742±0.030\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=1.55%, Trades=101\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.778\n",
      "      ✔ Fold 2: Accuracy accuracy 0.622\n",
      "      ✔ Fold 3: Accuracy accuracy 0.822\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.068\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-3.56%, Trades=92\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.800\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.689\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.055\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=1.40%, Trades=94\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.778\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.822\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.742±0.054\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ Neural_Standard: Test Return=3.15%, Trades=94\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.556\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.711±0.085\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1963% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1971% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2069% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2080% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-2.00%, Trades=66\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.800\n",
      "      ✔ Fold 2: Accuracy accuracy 0.644\n",
      "      ✔ Fold 3: Accuracy accuracy 0.844\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.747±0.070\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ XGBoost_Standard: Test Return=1.66%, Trades=93\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=546, test=181\n",
      "  📈 Buy-and-hold benchmark: Train=-5.55%, Test=-3.13%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.822\n",
      "      ✔ Fold 4: Accuracy accuracy 0.778\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.738±0.055\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ Logistic_Standard: Test Return=-0.16%, Trades=91\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0079]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0013\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0013\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 3.0057\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1540\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0531, Standard intercept: -0.0012\n",
      "       MADL coef norm: 0.5561, Standard coef norm: 2.3892\n",
      "       Coefficient difference norm: 1.8368\n",
      "      ✔ Fold 1: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0079]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0012\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0013\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 2.5405\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1303\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2008, Standard intercept: 0.2447\n",
      "       MADL coef norm: 0.5113, Standard coef norm: 2.2297\n",
      "       Coefficient difference norm: 1.7237\n",
      "      ✔ Fold 2: MADL accuracy 0.733\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0079]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0012\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0012\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0003, Total Loss = 1.9662\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1009\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1928, Standard intercept: 0.1762\n",
      "       MADL coef norm: 1.5508, Standard coef norm: 2.0259\n",
      "       Coefficient difference norm: 0.4760\n",
      "      ✔ Fold 3: MADL accuracy 0.822\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0100]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0015\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0017\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0005, Total Loss = 2.7472\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1408\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0452, Standard intercept: -0.0483\n",
      "       MADL coef norm: 0.5317, Standard coef norm: 2.2978\n",
      "       Coefficient difference norm: 1.7722\n",
      "      ✔ Fold 4: MADL accuracy 0.778\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0166]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0022\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 2.8243\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1445\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0645, Standard intercept: -0.1502\n",
      "       MADL coef norm: 0.5391, Standard coef norm: 2.2980\n",
      "       Coefficient difference norm: 1.7609\n",
      "      ✔ Fold 5: MADL accuracy 0.667\n",
      "    📊 MADL CV Results: Accuracy 0.742±0.054\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0166]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0023\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 2.3691\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1212\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1262, Standard intercept: -0.1425\n",
      "       MADL coef norm: 1.6493, Standard coef norm: 2.1458\n",
      "       Coefficient difference norm: 0.4969\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ Logistic_MADL: Test Return=1.34%, Trades=91\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.689\n",
      "      ✔ Fold 2: Accuracy accuracy 0.733\n",
      "      ✔ Fold 3: Accuracy accuracy 0.756\n",
      "      ✔ Fold 4: Accuracy accuracy 0.733\n",
      "      ✔ Fold 5: Accuracy accuracy 0.600\n",
      "    📊 Accuracy CV Results: Accuracy 0.702±0.056\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-0.51%, Trades=102\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.667\n",
      "      ✔ Fold 3: Accuracy accuracy 0.778\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.684±0.055\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-7.02%, Trades=105\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.556\n",
      "      ✔ Fold 2: Accuracy accuracy 0.600\n",
      "      ✔ Fold 3: Accuracy accuracy 0.667\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.689\n",
      "    📊 Accuracy CV Results: Accuracy 0.644±0.058\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-4.47%, Trades=93\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.644\n",
      "      ✔ Fold 2: Accuracy accuracy 0.556\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.658±0.057\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ Neural_Standard: Test Return=-11.50%, Trades=107\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.533\n",
      "      ✔ Fold 3: Accuracy accuracy 0.600\n",
      "      ✔ Fold 4: Accuracy accuracy 0.689\n",
      "      ✔ Fold 5: Accuracy accuracy 0.644\n",
      "    📊 Accuracy CV Results: Accuracy 0.636±0.064\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1920% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1935% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2068% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=1.89%, Trades=36\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.622\n",
      "      ✔ Fold 2: Accuracy accuracy 0.756\n",
      "      ✔ Fold 3: Accuracy accuracy 0.844\n",
      "      ✔ Fold 4: Accuracy accuracy 0.756\n",
      "      ✔ Fold 5: Accuracy accuracy 0.667\n",
      "    📊 Accuracy CV Results: Accuracy 0.729±0.077\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2066% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2062% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-5.27%, Trades=109\n",
      "\n",
      "📊 Period 3 completed: 128 successful model runs\n",
      "\n",
      "📍 PERIOD 4: Training 2018-01-01 to 2023-12-31\n",
      "------------------------------------------------------------\n",
      "\n",
      "💱 Processing EUR_USD...\n",
      "    ✅ EUR_USD: Total=1559 days, Train=1169 days, Test=390 days\n",
      "       📅 Train: 2018-01-01 to 2022-07-01\n",
      "       📅 Test:  2022-07-04 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 1509 rows\n",
      "    ✔ Loaded 13w_tbill: 1509 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=1167, test=388\n",
      "  📈 Buy-and-hold benchmark: Train=-13.15%, Test=5.96%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.732\n",
      "      ✔ Fold 2: Accuracy accuracy 0.794\n",
      "      ✔ Fold 3: Accuracy accuracy 0.763\n",
      "      ✔ Fold 4: Accuracy accuracy 0.763\n",
      "      ✔ Fold 5: Accuracy accuracy 0.670\n",
      "    📊 Accuracy CV Results: Accuracy 0.744±0.042\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ Logistic_Standard: Test Return=378.70%, Trades=246\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0037\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.4547\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0738\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0046, Standard intercept: -0.0502\n",
      "       MADL coef norm: 1.2739, Standard coef norm: 1.6542\n",
      "       Coefficient difference norm: 0.3803\n",
      "      ✔ Fold 1: MADL accuracy 0.722\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0033\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.3335\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0677\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1298, Standard intercept: -0.1138\n",
      "       MADL coef norm: 1.2432, Standard coef norm: 1.6174\n",
      "       Coefficient difference norm: 0.3743\n",
      "      ✔ Fold 2: MADL accuracy 0.773\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.3977\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0712\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2281, Standard intercept: -0.1799\n",
      "       MADL coef norm: 1.3300, Standard coef norm: 1.7383\n",
      "       Coefficient difference norm: 0.4086\n",
      "      ✔ Fold 3: MADL accuracy 0.763\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5507\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0788\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0088, Standard intercept: 0.0149\n",
      "       MADL coef norm: 1.3465, Standard coef norm: 1.7524\n",
      "       Coefficient difference norm: 0.4059\n",
      "      ✔ Fold 4: MADL accuracy 0.763\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.7121\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0870\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0384, Standard intercept: -0.0145\n",
      "       MADL coef norm: 1.3713, Standard coef norm: 1.7796\n",
      "       Coefficient difference norm: 0.4084\n",
      "      ✔ Fold 5: MADL accuracy 0.660\n",
      "    📊 MADL CV Results: Accuracy 0.736±0.042\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.6217\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0824\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0364, Standard intercept: -0.0821\n",
      "       MADL coef norm: 1.3544, Standard coef norm: 1.7599\n",
      "       Coefficient difference norm: 0.4055\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ Logistic_MADL: Test Return=397.88%, Trades=227\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.639\n",
      "      ✔ Fold 2: Accuracy accuracy 0.670\n",
      "      ✔ Fold 3: Accuracy accuracy 0.691\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.691\n",
      "    📊 Accuracy CV Results: Accuracy 0.685±0.030\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=364.69%, Trades=222\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.722\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.763\n",
      "      ✔ Fold 4: Accuracy accuracy 0.784\n",
      "      ✔ Fold 5: Accuracy accuracy 0.649\n",
      "    📊 Accuracy CV Results: Accuracy 0.728±0.046\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ RandomForest_Standard: Test Return=389.45%, Trades=203\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.670\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.784\n",
      "      ✔ Fold 4: Accuracy accuracy 0.763\n",
      "      ✔ Fold 5: Accuracy accuracy 0.691\n",
      "    📊 Accuracy CV Results: Accuracy 0.726±0.043\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=366.92%, Trades=213\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.732\n",
      "      ✔ Fold 2: Accuracy accuracy 0.784\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.736±0.033\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ Neural_Standard: Test Return=391.45%, Trades=225\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.722\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.722\n",
      "      ✔ Fold 5: Accuracy accuracy 0.660\n",
      "    📊 Accuracy CV Results: Accuracy 0.715±0.029\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0098% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=97.83%, Trades=111\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.753\n",
      "      ✔ Fold 4: Accuracy accuracy 0.763\n",
      "      ✔ Fold 5: Accuracy accuracy 0.660\n",
      "    📊 Accuracy CV Results: Accuracy 0.728±0.038\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ XGBoost_Standard: Test Return=386.23%, Trades=231\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=1166, test=388\n",
      "  📈 Buy-and-hold benchmark: Train=-13.15%, Test=5.96%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.588\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.763\n",
      "      ✔ Fold 4: Accuracy accuracy 0.753\n",
      "      ✔ Fold 5: Accuracy accuracy 0.691\n",
      "    📊 Accuracy CV Results: Accuracy 0.707±0.065\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ Logistic_Standard: Test Return=341.95%, Trades=215\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0001, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0037\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.5543\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0787\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0755, Standard intercept: -0.0918\n",
      "       MADL coef norm: 1.3231, Standard coef norm: 1.7203\n",
      "       Coefficient difference norm: 0.3977\n",
      "      ✔ Fold 1: MADL accuracy 0.598\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0191]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.4643\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0744\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1400, Standard intercept: -0.1268\n",
      "       MADL coef norm: 1.2749, Standard coef norm: 1.6569\n",
      "       Coefficient difference norm: 0.3827\n",
      "      ✔ Fold 2: MADL accuracy 0.732\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.3930\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0707\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1786, Standard intercept: -0.1953\n",
      "       MADL coef norm: 1.3141, Standard coef norm: 1.7188\n",
      "       Coefficient difference norm: 0.4057\n",
      "      ✔ Fold 3: MADL accuracy 0.763\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.5463\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0786\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0232, Standard intercept: -0.0049\n",
      "       MADL coef norm: 1.3245, Standard coef norm: 1.7237\n",
      "       Coefficient difference norm: 0.3998\n",
      "      ✔ Fold 4: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.7010\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0865\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0013, Standard intercept: -0.0244\n",
      "       MADL coef norm: 1.3638, Standard coef norm: 1.7698\n",
      "       Coefficient difference norm: 0.4062\n",
      "      ✔ Fold 5: MADL accuracy 0.691\n",
      "    📊 MADL CV Results: Accuracy 0.707±0.060\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0200]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.6391\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0834\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0682, Standard intercept: -0.0845\n",
      "       MADL coef norm: 1.3524, Standard coef norm: 1.7574\n",
      "       Coefficient difference norm: 0.4055\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ Logistic_MADL: Test Return=381.23%, Trades=220\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.639\n",
      "      ✔ Fold 2: Accuracy accuracy 0.577\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.546\n",
      "    📊 Accuracy CV Results: Accuracy 0.647±0.079\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=385.98%, Trades=229\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.639\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.773\n",
      "      ✔ Fold 4: Accuracy accuracy 0.773\n",
      "      ✔ Fold 5: Accuracy accuracy 0.649\n",
      "    📊 Accuracy CV Results: Accuracy 0.713±0.058\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ RandomForest_Standard: Test Return=251.33%, Trades=239\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.639\n",
      "      ✔ Fold 2: Accuracy accuracy 0.701\n",
      "      ✔ Fold 3: Accuracy accuracy 0.753\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.701±0.040\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=354.61%, Trades=246\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.670\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.699±0.024\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0120% cost\n",
      "    ✅ Neural_Standard: Test Return=148.39%, Trades=206\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.557\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.371\n",
      "      ✔ Fold 4: Accuracy accuracy 0.701\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.604±0.129\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0098% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=101.16%, Trades=128\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.649\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.753\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.649\n",
      "    📊 Accuracy CV Results: Accuracy 0.701±0.044\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0100% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0115% cost\n",
      "    💰 EUR_USD: 1.2 pips × 0.0001 pip_value = 0.0118% cost\n",
      "    ✅ XGBoost_Standard: Test Return=336.51%, Trades=251\n",
      "\n",
      "💱 Processing JPY_USD...\n",
      "    ✅ JPY_USD: Total=1565 days, Train=1173 days, Test=392 days\n",
      "       📅 Train: 2018-01-01 to 2022-06-29\n",
      "       📅 Test:  2022-06-30 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 1509 rows\n",
      "    ✔ Loaded 13w_tbill: 1509 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=1171, test=390\n",
      "  📈 Buy-and-hold benchmark: Train=-17.48%, Test=-3.16%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.784\n",
      "      ✔ Fold 2: Accuracy accuracy 0.794\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.835\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.781±0.037\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ Logistic_Standard: Test Return=232.54%, Trades=208\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.4711\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0748\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0372, Standard intercept: -0.0085\n",
      "       MADL coef norm: 1.2937, Standard coef norm: 1.6815\n",
      "       Coefficient difference norm: 0.3878\n",
      "      ✔ Fold 1: MADL accuracy 0.794\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.7245\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0877\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1248, Standard intercept: 0.1409\n",
      "       MADL coef norm: 1.4173, Standard coef norm: 1.8444\n",
      "       Coefficient difference norm: 0.4272\n",
      "      ✔ Fold 2: MADL accuracy 0.794\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0300]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 2.8322\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1444\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0885, Standard intercept: 0.0720\n",
      "       MADL coef norm: 0.5399, Standard coef norm: 2.4495\n",
      "       Coefficient difference norm: 1.9116\n",
      "      ✔ Fold 3: MADL accuracy 0.722\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0300]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 2.6418\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1349\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0287, Standard intercept: 0.0491\n",
      "       MADL coef norm: 0.5214, Standard coef norm: 2.2881\n",
      "       Coefficient difference norm: 1.7668\n",
      "      ✔ Fold 4: MADL accuracy 0.825\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0300]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0031\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 2.6978\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1378\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0406, Standard intercept: 0.0394\n",
      "       MADL coef norm: 0.5269, Standard coef norm: 2.2654\n",
      "       Coefficient difference norm: 1.7399\n",
      "      ✔ Fold 5: MADL accuracy 0.753\n",
      "    📊 MADL CV Results: Accuracy 0.777±0.036\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0300]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0032\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 2.5208\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1285\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0082, Standard intercept: -0.1441\n",
      "       MADL coef norm: 0.5094, Standard coef norm: 2.2058\n",
      "       Coefficient difference norm: 1.6968\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ Logistic_MADL: Test Return=201.38%, Trades=254\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.763\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.660\n",
      "      ✔ Fold 4: Accuracy accuracy 0.773\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.740±0.041\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=190.48%, Trades=205\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.814\n",
      "      ✔ Fold 2: Accuracy accuracy 0.804\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.804\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.777±0.039\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ RandomForest_Standard: Test Return=204.96%, Trades=202\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.845\n",
      "      ✔ Fold 2: Accuracy accuracy 0.773\n",
      "      ✔ Fold 3: Accuracy accuracy 0.691\n",
      "      ✔ Fold 4: Accuracy accuracy 0.804\n",
      "      ✔ Fold 5: Accuracy accuracy 0.784\n",
      "    📊 Accuracy CV Results: Accuracy 0.779±0.051\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=203.92%, Trades=214\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.804\n",
      "      ✔ Fold 2: Accuracy accuracy 0.794\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.825\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.786±0.032\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ Neural_Standard: Test Return=239.36%, Trades=200\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.773\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.825\n",
      "      ✔ Fold 5: Accuracy accuracy 0.732\n",
      "    📊 Accuracy CV Results: Accuracy 0.757±0.039\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1672% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2041% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2062% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=93.07%, Trades=116\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.845\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.825\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.784±0.046\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ XGBoost_Standard: Test Return=221.07%, Trades=227\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=1170, test=390\n",
      "  📈 Buy-and-hold benchmark: Train=-17.48%, Test=-3.16%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.753\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.845\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.763±0.043\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1697% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ Logistic_Standard: Test Return=234.36%, Trades=202\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0026\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5517\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0787\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0166, Standard intercept: -0.0329\n",
      "       MADL coef norm: 1.3169, Standard coef norm: 1.7115\n",
      "       Coefficient difference norm: 0.3952\n",
      "      ✔ Fold 1: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.7670\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0899\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1442, Standard intercept: 0.1574\n",
      "       MADL coef norm: 1.4255, Standard coef norm: 1.8556\n",
      "       Coefficient difference norm: 0.4306\n",
      "      ✔ Fold 2: MADL accuracy 0.742\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0300]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0035\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 2.7416\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1398\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1200, Standard intercept: 0.0645\n",
      "       MADL coef norm: 0.5312, Standard coef norm: 2.4030\n",
      "       Coefficient difference norm: 1.8807\n",
      "      ✔ Fold 3: MADL accuracy 0.660\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0300]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 2.5711\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1312\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1286, Standard intercept: 0.0351\n",
      "       MADL coef norm: 0.5144, Standard coef norm: 2.2414\n",
      "       Coefficient difference norm: 1.7332\n",
      "      ✔ Fold 4: MADL accuracy 0.825\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0300]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0030\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0031\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 2.6231\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1339\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1041, Standard intercept: 0.0183\n",
      "       MADL coef norm: 0.5196, Standard coef norm: 2.2340\n",
      "       Coefficient difference norm: 1.7166\n",
      "      ✔ Fold 5: MADL accuracy 0.722\n",
      "    📊 MADL CV Results: Accuracy 0.740±0.053\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0300]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0032\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 2.4443\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1246\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0906, Standard intercept: -0.1449\n",
      "       MADL coef norm: 0.5016, Standard coef norm: 2.1620\n",
      "       Coefficient difference norm: 1.6647\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1696% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ Logistic_MADL: Test Return=198.35%, Trades=247\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.608\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.619\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.649\n",
      "    📊 Accuracy CV Results: Accuracy 0.670±0.056\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1697% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=190.48%, Trades=205\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.608\n",
      "      ✔ Fold 2: Accuracy accuracy 0.794\n",
      "      ✔ Fold 3: Accuracy accuracy 0.701\n",
      "      ✔ Fold 4: Accuracy accuracy 0.835\n",
      "      ✔ Fold 5: Accuracy accuracy 0.722\n",
      "    📊 Accuracy CV Results: Accuracy 0.732±0.079\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1696% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ RandomForest_Standard: Test Return=175.62%, Trades=233\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.619\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.814\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.066\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1696% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=120.94%, Trades=213\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.753\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.577\n",
      "      ✔ Fold 4: Accuracy accuracy 0.773\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.707±0.070\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1697% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ Neural_Standard: Test Return=85.86%, Trades=218\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.546\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.588\n",
      "      ✔ Fold 4: Accuracy accuracy 0.763\n",
      "      ✔ Fold 5: Accuracy accuracy 0.474\n",
      "    📊 Accuracy CV Results: Accuracy 0.619±0.108\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1690% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1672% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2041% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2062% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=52.76%, Trades=70\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.732\n",
      "      ✔ Fold 2: Accuracy accuracy 0.763\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.835\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.757±0.043\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1685% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.1697% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2037% cost\n",
      "    💰 JPY_USD: 1.5 pips × 1e-05 pip_value = 0.2029% cost\n",
      "    ✅ XGBoost_Standard: Test Return=213.08%, Trades=220\n",
      "\n",
      "💱 Processing AUD_USD...\n",
      "    ✅ AUD_USD: Total=1563 days, Train=1172 days, Test=391 days\n",
      "       📅 Train: 2018-01-01 to 2022-06-29\n",
      "       📅 Test:  2022-06-30 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 1509 rows\n",
      "    ✔ Loaded 13w_tbill: 1509 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=1170, test=389\n",
      "  📈 Buy-and-hold benchmark: Train=-11.88%, Test=-0.93%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.753\n",
      "      ✔ Fold 2: Accuracy accuracy 0.784\n",
      "      ✔ Fold 3: Accuracy accuracy 0.784\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.732\n",
      "    📊 Accuracy CV Results: Accuracy 0.753±0.028\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ Logistic_Standard: Test Return=534.33%, Trades=225\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0147]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 1.5500\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0786\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2318, Standard intercept: -0.2774\n",
      "       MADL coef norm: 1.3223, Standard coef norm: 1.7179\n",
      "       Coefficient difference norm: 0.3957\n",
      "      ✔ Fold 1: MADL accuracy 0.742\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0189]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.4926\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0756\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1381, Standard intercept: -0.1221\n",
      "       MADL coef norm: 1.3055, Standard coef norm: 1.6972\n",
      "       Coefficient difference norm: 0.3918\n",
      "      ✔ Fold 2: MADL accuracy 0.773\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0383]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.8438\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0936\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3010, Standard intercept: -0.2529\n",
      "       MADL coef norm: 1.5310, Standard coef norm: 2.0011\n",
      "       Coefficient difference norm: 0.4703\n",
      "      ✔ Fold 3: MADL accuracy 0.773\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0383]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0043\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0041\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0016, Total Loss = 2.0170\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1023\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0545, Standard intercept: -0.0484\n",
      "       MADL coef norm: 1.5348, Standard coef norm: 1.9973\n",
      "       Coefficient difference norm: 0.4625\n",
      "      ✔ Fold 4: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0383]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0044\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.8839\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0954\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1163, Standard intercept: -0.0923\n",
      "       MADL coef norm: 1.4494, Standard coef norm: 1.8824\n",
      "       Coefficient difference norm: 0.4331\n",
      "      ✔ Fold 5: MADL accuracy 0.732\n",
      "    📊 MADL CV Results: Accuracy 0.746±0.024\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0383]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0046\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.7166\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0870\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0423, Standard intercept: -0.0880\n",
      "       MADL coef norm: 1.3967, Standard coef norm: 1.8153\n",
      "       Coefficient difference norm: 0.4186\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ Logistic_MADL: Test Return=555.44%, Trades=231\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.660\n",
      "      ✔ Fold 2: Accuracy accuracy 0.680\n",
      "      ✔ Fold 3: Accuracy accuracy 0.660\n",
      "      ✔ Fold 4: Accuracy accuracy 0.722\n",
      "      ✔ Fold 5: Accuracy accuracy 0.794\n",
      "    📊 Accuracy CV Results: Accuracy 0.703±0.051\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=477.74%, Trades=200\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.649\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.784\n",
      "      ✔ Fold 4: Accuracy accuracy 0.691\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.722±0.047\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ RandomForest_Standard: Test Return=518.86%, Trades=233\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.639\n",
      "      ✔ Fold 2: Accuracy accuracy 0.680\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.701\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.699±0.037\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=493.58%, Trades=270\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.670\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.763\n",
      "      ✔ Fold 4: Accuracy accuracy 0.722\n",
      "      ✔ Fold 5: Accuracy accuracy 0.732\n",
      "    📊 Accuracy CV Results: Accuracy 0.728±0.032\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ Neural_Standard: Test Return=543.12%, Trades=225\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.557\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.649\n",
      "      ✔ Fold 4: Accuracy accuracy 0.680\n",
      "      ✔ Fold 5: Accuracy accuracy 0.701\n",
      "    📊 Accuracy CV Results: Accuracy 0.664±0.060\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0249% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0247% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=106.82%, Trades=100\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.660\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.680\n",
      "      ✔ Fold 4: Accuracy accuracy 0.701\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.707±0.035\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ XGBoost_Standard: Test Return=491.36%, Trades=266\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=1169, test=389\n",
      "  📈 Buy-and-hold benchmark: Train=-11.88%, Test=-0.93%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.649\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.732\n",
      "    📊 Accuracy CV Results: Accuracy 0.711±0.033\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0253% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ Logistic_Standard: Test Return=346.29%, Trades=240\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0147]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0042\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0016, Total Loss = 1.9034\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0966\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3220, Standard intercept: -0.3383\n",
      "       MADL coef norm: 1.4727, Standard coef norm: 1.9156\n",
      "       Coefficient difference norm: 0.4433\n",
      "      ✔ Fold 1: MADL accuracy 0.639\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0189]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0033\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5671\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0796\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1501, Standard intercept: -0.1369\n",
      "       MADL coef norm: 1.3157, Standard coef norm: 1.7094\n",
      "       Coefficient difference norm: 0.3943\n",
      "      ✔ Fold 2: MADL accuracy 0.722\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0383]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0040\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0039\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.9272\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0977\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2345, Standard intercept: -0.2512\n",
      "       MADL coef norm: 1.5511, Standard coef norm: 2.0282\n",
      "       Coefficient difference norm: 0.4779\n",
      "      ✔ Fold 3: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0383]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0043\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0041\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 2.0758\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1055\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0286, Standard intercept: -0.0567\n",
      "       MADL coef norm: 1.5406, Standard coef norm: 2.0049\n",
      "       Coefficient difference norm: 0.4649\n",
      "      ✔ Fold 4: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0383]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0044\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0014, Total Loss = 1.8993\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0964\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0640, Standard intercept: -0.0897\n",
      "       MADL coef norm: 1.4533, Standard coef norm: 1.8874\n",
      "       Coefficient difference norm: 0.4343\n",
      "      ✔ Fold 5: MADL accuracy 0.732\n",
      "    📊 MADL CV Results: Accuracy 0.711±0.039\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0383]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0046\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0040\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0015, Total Loss = 1.7818\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0901\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0755, Standard intercept: -0.0917\n",
      "       MADL coef norm: 1.4078, Standard coef norm: 1.8291\n",
      "       Coefficient difference norm: 0.4217\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ Logistic_MADL: Test Return=579.81%, Trades=237\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.619\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.732\n",
      "    📊 Accuracy CV Results: Accuracy 0.680±0.047\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=377.60%, Trades=231\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.670\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.722±0.033\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ RandomForest_Standard: Test Return=444.18%, Trades=257\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.784\n",
      "      ✔ Fold 3: Accuracy accuracy 0.701\n",
      "      ✔ Fold 4: Accuracy accuracy 0.701\n",
      "      ✔ Fold 5: Accuracy accuracy 0.732\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.050\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=461.72%, Trades=263\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.660\n",
      "      ✔ Fold 2: Accuracy accuracy 0.495\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.639\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.649±0.086\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0256% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0292% cost\n",
      "    ✅ Neural_Standard: Test Return=185.24%, Trades=211\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.608\n",
      "      ✔ Fold 2: Accuracy accuracy 0.536\n",
      "      ✔ Fold 3: Accuracy accuracy 0.629\n",
      "      ✔ Fold 4: Accuracy accuracy 0.680\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.633±0.061\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0249% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0247% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=55.02%, Trades=66\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.701\n",
      "      ✔ Fold 2: Accuracy accuracy 0.794\n",
      "      ✔ Fold 3: Accuracy accuracy 0.701\n",
      "      ✔ Fold 4: Accuracy accuracy 0.691\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.730±0.041\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0255% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0254% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0290% cost\n",
      "    💰 AUD_USD: 2.0 pips × 0.0001 pip_value = 0.0294% cost\n",
      "    ✅ XGBoost_Standard: Test Return=447.19%, Trades=270\n",
      "\n",
      "💱 Processing CHF_USD...\n",
      "    ✅ CHF_USD: Total=1564 days, Train=1173 days, Test=391 days\n",
      "       📅 Train: 2018-01-01 to 2022-06-30\n",
      "       📅 Test:  2022-07-01 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 1509 rows\n",
      "    ✔ Loaded 13w_tbill: 1509 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=1171, test=389\n",
      "  📈 Buy-and-hold benchmark: Train=1.89%, Test=13.50%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.701\n",
      "      ✔ Fold 4: Accuracy accuracy 0.773\n",
      "      ✔ Fold 5: Accuracy accuracy 0.722\n",
      "    📊 Accuracy CV Results: Accuracy 0.732±0.027\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ Logistic_Standard: Test Return=443.35%, Trades=221\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0033\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0012, Total Loss = 1.7829\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0905\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0333, Standard intercept: -0.0124\n",
      "       MADL coef norm: 1.4142, Standard coef norm: 1.8368\n",
      "       Coefficient difference norm: 0.4226\n",
      "      ✔ Fold 1: MADL accuracy 0.722\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.4387\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0731\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1427, Standard intercept: -0.1266\n",
      "       MADL coef norm: 1.2779, Standard coef norm: 1.6609\n",
      "       Coefficient difference norm: 0.3831\n",
      "      ✔ Fold 2: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.4732\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0752\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2487, Standard intercept: -0.2006\n",
      "       MADL coef norm: 1.3843, Standard coef norm: 1.8113\n",
      "       Coefficient difference norm: 0.4273\n",
      "      ✔ Fold 3: MADL accuracy 0.691\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.5240\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0776\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0318, Standard intercept: -0.0257\n",
      "       MADL coef norm: 1.3374, Standard coef norm: 1.7409\n",
      "       Coefficient difference norm: 0.4035\n",
      "      ✔ Fold 4: MADL accuracy 0.763\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0008, Total Loss = 1.5865\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0807\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1175, Standard intercept: -0.0935\n",
      "       MADL coef norm: 1.3330, Standard coef norm: 1.7317\n",
      "       Coefficient difference norm: 0.3989\n",
      "      ✔ Fold 5: MADL accuracy 0.732\n",
      "    📊 MADL CV Results: Accuracy 0.732±0.025\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0302]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.6603\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0845\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0578, Standard intercept: -0.1035\n",
      "       MADL coef norm: 1.3665, Standard coef norm: 1.7751\n",
      "       Coefficient difference norm: 0.4086\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ Logistic_MADL: Test Return=461.47%, Trades=216\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.680\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.701\n",
      "      ✔ Fold 4: Accuracy accuracy 0.753\n",
      "      ✔ Fold 5: Accuracy accuracy 0.722\n",
      "    📊 Accuracy CV Results: Accuracy 0.715±0.024\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=382.97%, Trades=182\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.701\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.670\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.699±0.022\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ RandomForest_Standard: Test Return=404.44%, Trades=215\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.701\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.691\n",
      "      ✔ Fold 4: Accuracy accuracy 0.763\n",
      "      ✔ Fold 5: Accuracy accuracy 0.660\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.035\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=405.64%, Trades=207\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.722\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.701\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.701\n",
      "    📊 Accuracy CV Results: Accuracy 0.718±0.019\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ Neural_Standard: Test Return=466.73%, Trades=208\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.660\n",
      "      ✔ Fold 2: Accuracy accuracy 0.680\n",
      "      ✔ Fold 3: Accuracy accuracy 0.680\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.026\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=90.32%, Trades=89\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.670\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.701\n",
      "      ✔ Fold 4: Accuracy accuracy 0.722\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.024\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ XGBoost_Standard: Test Return=419.01%, Trades=222\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=1170, test=389\n",
      "  📈 Buy-and-hold benchmark: Train=1.89%, Test=13.50%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.773\n",
      "      ✔ Fold 3: Accuracy accuracy 0.649\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.705±0.056\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ Logistic_Standard: Test Return=468.49%, Trades=209\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0033\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0013, Total Loss = 2.0120\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1020\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0389, Standard intercept: 0.0226\n",
      "       MADL coef norm: 1.4966, Standard coef norm: 1.9444\n",
      "       Coefficient difference norm: 0.4482\n",
      "      ✔ Fold 1: MADL accuracy 0.619\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0130]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0029\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0025\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5964\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0812\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1259, Standard intercept: -0.1127\n",
      "       MADL coef norm: 1.3212, Standard coef norm: 1.7156\n",
      "       Coefficient difference norm: 0.3950\n",
      "      ✔ Fold 2: MADL accuracy 0.773\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0011, Total Loss = 1.5150\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0769\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1926, Standard intercept: -0.2093\n",
      "       MADL coef norm: 1.3956, Standard coef norm: 1.8279\n",
      "       Coefficient difference norm: 0.4333\n",
      "      ✔ Fold 3: MADL accuracy 0.660\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.5908\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0808\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0012, Standard intercept: -0.0268\n",
      "       MADL coef norm: 1.3479, Standard coef norm: 1.7546\n",
      "       Coefficient difference norm: 0.4074\n",
      "      ✔ Fold 4: MADL accuracy 0.722\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0207]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0031\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0027\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.6057\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0817\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0679, Standard intercept: -0.0936\n",
      "       MADL coef norm: 1.3393, Standard coef norm: 1.7400\n",
      "       Coefficient difference norm: 0.4009\n",
      "      ✔ Fold 5: MADL accuracy 0.742\n",
      "    📊 MADL CV Results: Accuracy 0.703±0.056\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0302]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0032\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0028\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0010, Total Loss = 1.7043\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0868\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0836, Standard intercept: -0.0999\n",
      "       MADL coef norm: 1.3738, Standard coef norm: 1.7846\n",
      "       Coefficient difference norm: 0.4112\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ Logistic_MADL: Test Return=461.13%, Trades=207\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.526\n",
      "      ✔ Fold 2: Accuracy accuracy 0.588\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.691\n",
      "      ✔ Fold 5: Accuracy accuracy 0.660\n",
      "    📊 Accuracy CV Results: Accuracy 0.641±0.076\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=344.15%, Trades=238\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.680\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.649\n",
      "      ✔ Fold 4: Accuracy accuracy 0.691\n",
      "      ✔ Fold 5: Accuracy accuracy 0.722\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.027\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ RandomForest_Standard: Test Return=374.03%, Trades=225\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.701\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.649\n",
      "      ✔ Fold 4: Accuracy accuracy 0.680\n",
      "      ✔ Fold 5: Accuracy accuracy 0.629\n",
      "    📊 Accuracy CV Results: Accuracy 0.674±0.031\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=365.65%, Trades=229\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.546\n",
      "      ✔ Fold 2: Accuracy accuracy 0.701\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.691\n",
      "      ✔ Fold 5: Accuracy accuracy 0.649\n",
      "    📊 Accuracy CV Results: Accuracy 0.666±0.067\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    ✅ Neural_Standard: Test Return=257.93%, Trades=193\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.577\n",
      "      ✔ Fold 2: Accuracy accuracy 0.577\n",
      "      ✔ Fold 3: Accuracy accuracy 0.608\n",
      "      ✔ Fold 4: Accuracy accuracy 0.763\n",
      "      ✔ Fold 5: Accuracy accuracy 0.485\n",
      "    📊 Accuracy CV Results: Accuracy 0.602±0.090\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0236% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0238% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0245% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0242% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=22.38%, Trades=44\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.691\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.649\n",
      "      ✔ Fold 4: Accuracy accuracy 0.691\n",
      "      ✔ Fold 5: Accuracy accuracy 0.722\n",
      "    📊 Accuracy CV Results: Accuracy 0.697±0.029\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0243% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0244% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0240% cost\n",
      "    💰 CHF_USD: 2.5 pips × 0.0001 pip_value = 0.0246% cost\n",
      "    ✅ XGBoost_Standard: Test Return=442.98%, Trades=215\n",
      "\n",
      "💱 Processing MXN_USD...\n",
      "    ✅ MXN_USD: Total=1565 days, Train=1173 days, Test=392 days\n",
      "       📅 Train: 2018-01-01 to 2022-06-29\n",
      "       📅 Test:  2022-06-30 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 1509 rows\n",
      "    ✔ Loaded 13w_tbill: 1509 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=1171, test=390\n",
      "  📈 Buy-and-hold benchmark: Train=-2.26%, Test=18.60%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.722\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.773\n",
      "      ✔ Fold 4: Accuracy accuracy 0.753\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.744±0.024\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    ✅ Logistic_Standard: Test Return=-51.42%, Trades=221\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0062\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0048\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0022, Total Loss = 1.2891\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0648\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3644, Standard intercept: 0.3187\n",
      "       MADL coef norm: 1.2122, Standard coef norm: 1.5756\n",
      "       Coefficient difference norm: 0.3635\n",
      "      ✔ Fold 1: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0057\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0047\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0017, Total Loss = 1.4427\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0724\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2461, Standard intercept: 0.2622\n",
      "       MADL coef norm: 1.2817, Standard coef norm: 1.6660\n",
      "       Coefficient difference norm: 0.3844\n",
      "      ✔ Fold 2: MADL accuracy 0.742\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0056\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0020, Total Loss = 1.5325\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0772\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0207, Standard intercept: 0.0274\n",
      "       MADL coef norm: 1.4153, Standard coef norm: 1.8523\n",
      "       Coefficient difference norm: 0.4371\n",
      "      ✔ Fold 3: MADL accuracy 0.773\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0063\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0060\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0022, Total Loss = 1.7666\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0889\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1155, Standard intercept: 0.1216\n",
      "       MADL coef norm: 1.4384, Standard coef norm: 1.8720\n",
      "       Coefficient difference norm: 0.4337\n",
      "      ✔ Fold 4: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0061\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0058\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0020, Total Loss = 1.8471\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0932\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0910, Standard intercept: 0.1150\n",
      "       MADL coef norm: 1.4433, Standard coef norm: 1.8754\n",
      "       Coefficient difference norm: 0.4323\n",
      "      ✔ Fold 5: MADL accuracy 0.763\n",
      "    📊 MADL CV Results: Accuracy 0.757±0.011\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0059\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0056\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 1.9052\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0965\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1777, Standard intercept: 0.1320\n",
      "       MADL coef norm: 1.4706, Standard coef norm: 1.9112\n",
      "       Coefficient difference norm: 0.4406\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8109% cost\n",
      "    ✅ Logistic_MADL: Test Return=-41.01%, Trades=220\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.660\n",
      "      ✔ Fold 2: Accuracy accuracy 0.763\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.680\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.715±0.042\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8109% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-56.08%, Trades=230\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.773\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.794\n",
      "    📊 Accuracy CV Results: Accuracy 0.753±0.028\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8109% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-61.74%, Trades=220\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.722\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.736±0.011\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-59.58%, Trades=223\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.732\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.784\n",
      "      ✔ Fold 4: Accuracy accuracy 0.763\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.746±0.032\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    ✅ Neural_Standard: Test Return=-53.41%, Trades=219\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.722\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.804\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.744±0.035\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7722% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7619% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8340% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8220% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=7.67%, Trades=45\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.732\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.794\n",
      "      ✔ Fold 4: Accuracy accuracy 0.753\n",
      "      ✔ Fold 5: Accuracy accuracy 0.722\n",
      "    📊 Accuracy CV Results: Accuracy 0.751±0.025\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7874% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-61.35%, Trades=223\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=1170, test=390\n",
      "  📈 Buy-and-hold benchmark: Train=-2.26%, Test=18.60%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.588\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.794\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.720±0.071\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    ✅ Logistic_Standard: Test Return=-51.41%, Trades=221\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0236]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0062\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0048\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0025, Total Loss = 1.5607\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0786\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.3310, Standard intercept: 0.3148\n",
      "       MADL coef norm: 1.3200, Standard coef norm: 1.7155\n",
      "       Coefficient difference norm: 0.3959\n",
      "      ✔ Fold 1: MADL accuracy 0.588\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0322]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0057\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0047\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 1.5190\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0763\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.2497, Standard intercept: 0.2629\n",
      "       MADL coef norm: 1.2949, Standard coef norm: 1.6823\n",
      "       Coefficient difference norm: 0.3881\n",
      "      ✔ Fold 2: MADL accuracy 0.670\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0056\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0057\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0018, Total Loss = 1.5269\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0771\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0087, Standard intercept: -0.0080\n",
      "       MADL coef norm: 1.4054, Standard coef norm: 1.8411\n",
      "       Coefficient difference norm: 0.4367\n",
      "      ✔ Fold 3: MADL accuracy 0.773\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0063\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0060\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 1.7970\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0910\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1425, Standard intercept: 0.1144\n",
      "       MADL coef norm: 1.4350, Standard coef norm: 1.8679\n",
      "       Coefficient difference norm: 0.4335\n",
      "      ✔ Fold 4: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0061\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0058\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0019, Total Loss = 1.8569\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0940\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1328, Standard intercept: 0.1071\n",
      "       MADL coef norm: 1.4467, Standard coef norm: 1.8802\n",
      "       Coefficient difference norm: 0.4337\n",
      "      ✔ Fold 5: MADL accuracy 0.763\n",
      "    📊 MADL CV Results: Accuracy 0.709±0.071\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0425]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0059\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0056\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0022, Total Loss = 1.9363\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0979\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.1453, Standard intercept: 0.1290\n",
      "       MADL coef norm: 1.4708, Standard coef norm: 1.9111\n",
      "       Coefficient difference norm: 0.4408\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8109% cost\n",
      "    ✅ Logistic_MADL: Test Return=-49.87%, Trades=228\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.598\n",
      "      ✔ Fold 2: Accuracy accuracy 0.680\n",
      "      ✔ Fold 3: Accuracy accuracy 0.784\n",
      "      ✔ Fold 4: Accuracy accuracy 0.691\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.699±0.063\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8121% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8265% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-54.96%, Trades=234\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.598\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.814\n",
      "      ✔ Fold 4: Accuracy accuracy 0.773\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.736±0.073\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8214% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-62.18%, Trades=253\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.577\n",
      "      ✔ Fold 2: Accuracy accuracy 0.680\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.753\n",
      "      ✔ Fold 5: Accuracy accuracy 0.711\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.063\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8109% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-53.52%, Trades=253\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.505\n",
      "      ✔ Fold 2: Accuracy accuracy 0.680\n",
      "      ✔ Fold 3: Accuracy accuracy 0.608\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.660±0.094\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8214% cost\n",
      "    ✅ Neural_Standard: Test Return=-81.38%, Trades=205\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.567\n",
      "      ✔ Fold 2: Accuracy accuracy 0.598\n",
      "      ✔ Fold 3: Accuracy accuracy 0.670\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.691\n",
      "    📊 Accuracy CV Results: Accuracy 0.652±0.061\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7722% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7619% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8340% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8220% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-4.57%, Trades=39\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.608\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.804\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.724±0.069\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7828% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.7678% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8049% cost\n",
      "    💰 MXN_USD: 8.0 pips × 5e-05 pip_value = 0.8109% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-40.10%, Trades=240\n",
      "\n",
      "💱 Processing ZAR_USD...\n",
      "    ✅ ZAR_USD: Total=1562 days, Train=1171 days, Test=391 days\n",
      "       📅 Train: 2018-01-01 to 2022-06-30\n",
      "       📅 Test:  2022-07-01 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 1509 rows\n",
      "    ✔ Loaded 13w_tbill: 1509 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=1169, test=389\n",
      "  📈 Buy-and-hold benchmark: Train=-23.94%, Test=-10.93%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.794\n",
      "      ✔ Fold 2: Accuracy accuracy 0.773\n",
      "      ✔ Fold 3: Accuracy accuracy 0.773\n",
      "      ✔ Fold 4: Accuracy accuracy 0.804\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.781±0.015\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ Logistic_Standard: Test Return=37.66%, Trades=209\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0084\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0066\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0032, Total Loss = 1.6144\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0801\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0036, Standard intercept: -0.0421\n",
      "       MADL coef norm: 1.3578, Standard coef norm: 1.7650\n",
      "       Coefficient difference norm: 0.4073\n",
      "      ✔ Fold 1: MADL accuracy 0.794\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0080\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 1.7973\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0896\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0820, Standard intercept: 0.0981\n",
      "       MADL coef norm: 1.4328, Standard coef norm: 1.8627\n",
      "       Coefficient difference norm: 0.4299\n",
      "      ✔ Fold 2: MADL accuracy 0.773\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0333]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0076\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0026, Total Loss = 1.5089\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0759\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1946, Standard intercept: -0.1465\n",
      "       MADL coef norm: 1.4073, Standard coef norm: 1.8420\n",
      "       Coefficient difference norm: 0.4350\n",
      "      ✔ Fold 3: MADL accuracy 0.784\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0079\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0063\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 1.9127\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0955\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0506, Standard intercept: -0.0445\n",
      "       MADL coef norm: 1.4959, Standard coef norm: 1.9468\n",
      "       Coefficient difference norm: 0.4509\n",
      "      ✔ Fold 4: MADL accuracy 0.804\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0078\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0028, Total Loss = 1.9603\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0983\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0633, Standard intercept: -0.0394\n",
      "       MADL coef norm: 1.4947, Standard coef norm: 1.9432\n",
      "       Coefficient difference norm: 0.4487\n",
      "      ✔ Fold 5: MADL accuracy 0.753\n",
      "    📊 MADL CV Results: Accuracy 0.781±0.018\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0078\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 1.8278\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0915\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0560, Standard intercept: 0.0103\n",
      "       MADL coef norm: 1.4473, Standard coef norm: 1.8817\n",
      "       Coefficient difference norm: 0.4345\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ Logistic_MADL: Test Return=43.33%, Trades=220\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.691\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.753\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.794\n",
      "    📊 Accuracy CV Results: Accuracy 0.734±0.039\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6579% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=32.42%, Trades=180\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.784\n",
      "      ✔ Fold 2: Accuracy accuracy 0.701\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.763\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.751±0.028\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-8.64%, Trades=224\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.784\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.804\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.761±0.029\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=13.31%, Trades=214\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.773\n",
      "      ✔ Fold 2: Accuracy accuracy 0.794\n",
      "      ✔ Fold 3: Accuracy accuracy 0.773\n",
      "      ✔ Fold 4: Accuracy accuracy 0.773\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.777±0.008\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ Neural_Standard: Test Return=44.99%, Trades=204\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.784\n",
      "      ✔ Fold 2: Accuracy accuracy 0.763\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.794\n",
      "      ✔ Fold 5: Accuracy accuracy 0.722\n",
      "    📊 Accuracy CV Results: Accuracy 0.757±0.030\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4773% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4860% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6645% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6745% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=12.49%, Trades=34\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.784\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.753\n",
      "      ✔ Fold 4: Accuracy accuracy 0.814\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.761±0.035\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4981% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ XGBoost_Standard: Test Return=21.64%, Trades=232\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=1168, test=389\n",
      "  📈 Buy-and-hold benchmark: Train=-23.94%, Test=-10.93%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.701\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.814\n",
      "      ✔ Fold 4: Accuracy accuracy 0.773\n",
      "      ✔ Fold 5: Accuracy accuracy 0.784\n",
      "    📊 Accuracy CV Results: Accuracy 0.753±0.048\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ Logistic_Standard: Test Return=14.10%, Trades=209\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0084\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0066\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 1.7239\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0855\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0389, Standard intercept: -0.0552\n",
      "       MADL coef norm: 1.3952, Standard coef norm: 1.8141\n",
      "       Coefficient difference norm: 0.4193\n",
      "      ✔ Fold 1: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0329]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0080\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 1.8881\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0940\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0845, Standard intercept: 0.0976\n",
      "       MADL coef norm: 1.4488, Standard coef norm: 1.8825\n",
      "       Coefficient difference norm: 0.4342\n",
      "      ✔ Fold 2: MADL accuracy 0.680\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0333]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0076\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0024, Total Loss = 1.6075\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0801\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1416, Standard intercept: -0.1582\n",
      "       MADL coef norm: 1.4448, Standard coef norm: 1.8929\n",
      "       Coefficient difference norm: 0.4490\n",
      "      ✔ Fold 3: MADL accuracy 0.794\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0079\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0063\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 2.0319\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1018\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0227, Standard intercept: -0.0508\n",
      "       MADL coef norm: 1.5290, Standard coef norm: 1.9903\n",
      "       Coefficient difference norm: 0.4619\n",
      "      ✔ Fold 4: MADL accuracy 0.773\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0078\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 2.0066\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1006\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.0266, Standard intercept: -0.0523\n",
      "       MADL coef norm: 1.5111, Standard coef norm: 1.9646\n",
      "       Coefficient difference norm: 0.4538\n",
      "      ✔ Fold 5: MADL accuracy 0.784\n",
      "    📊 MADL CV Results: Accuracy 0.748±0.045\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0399]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0078\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0062\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 1.8746\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0937\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: 0.0216, Standard intercept: 0.0053\n",
      "       MADL coef norm: 1.4563, Standard coef norm: 1.8935\n",
      "       Coefficient difference norm: 0.4377\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ Logistic_MADL: Test Return=16.09%, Trades=214\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.680\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.701\n",
      "      ✔ Fold 5: Accuracy accuracy 0.794\n",
      "    📊 Accuracy CV Results: Accuracy 0.715±0.041\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6579% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-75.96%, Trades=216\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.773\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.753\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.740±0.022\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6579% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-24.60%, Trades=250\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.680\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.784\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.734±0.034\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=10.85%, Trades=258\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.577\n",
      "      ✔ Fold 2: Accuracy accuracy 0.629\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.629\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.662±0.064\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4944% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6579% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    ✅ Neural_Standard: Test Return=-48.07%, Trades=179\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.763\n",
      "      ✔ Fold 4: Accuracy accuracy 0.722\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.728±0.027\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4884% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6645% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6745% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=14.21%, Trades=48\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.701\n",
      "      ✔ Fold 2: Accuracy accuracy 0.691\n",
      "      ✔ Fold 3: Accuracy accuracy 0.784\n",
      "      ✔ Fold 4: Accuracy accuracy 0.773\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.742±0.039\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.5013% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.4950% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6568% cost\n",
      "    💰 ZAR_USD: 8.0 pips × 5e-05 pip_value = 0.6768% cost\n",
      "    ✅ XGBoost_Standard: Test Return=19.14%, Trades=235\n",
      "\n",
      "💱 Processing TRY_USD...\n",
      "    ✅ TRY_USD: Total=1565 days, Train=1173 days, Test=392 days\n",
      "       📅 Train: 2018-01-01 to 2022-06-29\n",
      "       📅 Test:  2022-06-30 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 1509 rows\n",
      "    ✔ Loaded 13w_tbill: 1509 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=1171, test=390\n",
      "  📈 Buy-and-hold benchmark: Train=-77.29%, Test=-43.71%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.814\n",
      "      ✔ Fold 2: Accuracy accuracy 0.711\n",
      "      ✔ Fold 3: Accuracy accuracy 0.722\n",
      "      ✔ Fold 4: Accuracy accuracy 0.784\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.761±0.039\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ Logistic_Standard: Test Return=-15.39%, Trades=174\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0117\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0149\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0045, Total Loss = 1.7879\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0881\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2491, Standard intercept: -0.2948\n",
      "       MADL coef norm: 1.4237, Standard coef norm: 1.8500\n",
      "       Coefficient difference norm: 0.4263\n",
      "      ✔ Fold 1: MADL accuracy 0.814\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0096\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0121\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0041, Total Loss = 2.5800\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1296\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2351, Standard intercept: -0.1816\n",
      "       MADL coef norm: 0.5156, Standard coef norm: 2.2524\n",
      "       Coefficient difference norm: 1.7374\n",
      "      ✔ Fold 2: MADL accuracy 0.629\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0079\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0105\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 2.5053\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1265\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4604, Standard intercept: -0.2999\n",
      "       MADL coef norm: 0.5080, Standard coef norm: 2.3043\n",
      "       Coefficient difference norm: 1.7985\n",
      "      ✔ Fold 3: MADL accuracy 0.670\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0073\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0098\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 2.8599\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1448\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3424, Standard intercept: -0.3220\n",
      "       MADL coef norm: 0.5427, Standard coef norm: 2.3832\n",
      "       Coefficient difference norm: 1.8406\n",
      "      ✔ Fold 4: MADL accuracy 0.639\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0072\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0093\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0028, Total Loss = 2.9874\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1515\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3693, Standard intercept: -0.2894\n",
      "       MADL coef norm: 0.5546, Standard coef norm: 2.3809\n",
      "       Coefficient difference norm: 1.8276\n",
      "      ✔ Fold 5: MADL accuracy 0.691\n",
      "    📊 MADL CV Results: Accuracy 0.689±0.067\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0080\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0125\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 3.7084\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1882\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3847, Standard intercept: -0.5370\n",
      "       MADL coef norm: 0.6179, Standard coef norm: 2.6779\n",
      "       Coefficient difference norm: 2.0603\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ Logistic_MADL: Test Return=148.50%, Trades=33\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.763\n",
      "      ✔ Fold 2: Accuracy accuracy 0.670\n",
      "      ✔ Fold 3: Accuracy accuracy 0.763\n",
      "      ✔ Fold 4: Accuracy accuracy 0.825\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.753±0.050\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5210% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-79.96%, Trades=257\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.804\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.835\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.773±0.040\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5210% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-74.66%, Trades=230\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.814\n",
      "      ✔ Fold 2: Accuracy accuracy 0.763\n",
      "      ✔ Fold 3: Accuracy accuracy 0.763\n",
      "      ✔ Fold 4: Accuracy accuracy 0.845\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.786±0.038\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5210% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-70.61%, Trades=222\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.814\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.753\n",
      "      ✔ Fold 4: Accuracy accuracy 0.804\n",
      "      ✔ Fold 5: Accuracy accuracy 0.804\n",
      "    📊 Accuracy CV Results: Accuracy 0.781±0.033\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ Neural_Standard: Test Return=-33.06%, Trades=171\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.732\n",
      "      ✔ Fold 2: Accuracy accuracy 0.773\n",
      "      ✔ Fold 3: Accuracy accuracy 0.784\n",
      "      ✔ Fold 4: Accuracy accuracy 0.804\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.771±0.024\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.2068% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1792% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5688% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5693% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-1.42%, Trades=6\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.804\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.814\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.771±0.033\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5210% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-74.47%, Trades=242\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=1170, test=390\n",
      "  📈 Buy-and-hold benchmark: Train=-77.29%, Test=-43.71%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.680\n",
      "      ✔ Fold 4: Accuracy accuracy 0.753\n",
      "      ✔ Fold 5: Accuracy accuracy 0.784\n",
      "    📊 Accuracy CV Results: Accuracy 0.736±0.036\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ Logistic_Standard: Test Return=-70.70%, Trades=235\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0118\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0149\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0050, Total Loss = 1.9658\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0971\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3201, Standard intercept: -0.3363\n",
      "       MADL coef norm: 1.4755, Standard coef norm: 1.9162\n",
      "       Coefficient difference norm: 0.4412\n",
      "      ✔ Fold 1: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0096\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0121\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0045, Total Loss = 2.7580\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1386\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2347, Standard intercept: -0.1908\n",
      "       MADL coef norm: 0.5331, Standard coef norm: 2.3074\n",
      "       Coefficient difference norm: 1.7793\n",
      "      ✔ Fold 2: MADL accuracy 0.619\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0079\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0105\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0033, Total Loss = 2.6112\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1314\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2856, Standard intercept: -0.3412\n",
      "       MADL coef norm: 0.5186, Standard coef norm: 2.3592\n",
      "       Coefficient difference norm: 1.8495\n",
      "      ✔ Fold 3: MADL accuracy 0.680\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0073\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0098\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0030, Total Loss = 3.0172\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1528\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2468, Standard intercept: -0.3403\n",
      "       MADL coef norm: 0.5574, Standard coef norm: 2.4354\n",
      "       Coefficient difference norm: 1.8837\n",
      "      ✔ Fold 4: MADL accuracy 0.691\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.1373]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0072\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0093\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0029, Total Loss = 3.0894\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1565\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2227, Standard intercept: -0.3084\n",
      "       MADL coef norm: 0.5640, Standard coef norm: 2.4210\n",
      "       Coefficient difference norm: 1.8590\n",
      "      ✔ Fold 5: MADL accuracy 0.701\n",
      "    📊 MADL CV Results: Accuracy 0.680±0.033\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.2181]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0080\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0125\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0032, Total Loss = 3.7472\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "    ✓ MADL optimization completed! Final loss: 0.1903\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.4940, Standard intercept: -0.5483\n",
      "       MADL coef norm: 0.6211, Standard coef norm: 2.6843\n",
      "       Coefficient difference norm: 2.0665\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ Logistic_MADL: Test Return=31.74%, Trades=123\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.649\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.825\n",
      "      ✔ Fold 5: Accuracy accuracy 0.742\n",
      "    📊 Accuracy CV Results: Accuracy 0.736±0.056\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5200% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=-69.49%, Trades=229\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.691\n",
      "      ✔ Fold 2: Accuracy accuracy 0.794\n",
      "      ✔ Fold 3: Accuracy accuracy 0.670\n",
      "      ✔ Fold 4: Accuracy accuracy 0.845\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.753±0.065\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ RandomForest_Standard: Test Return=-66.96%, Trades=224\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.670\n",
      "      ✔ Fold 4: Accuracy accuracy 0.825\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.730±0.071\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=-24.76%, Trades=200\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.629\n",
      "      ✔ Fold 2: Accuracy accuracy 0.701\n",
      "      ✔ Fold 3: Accuracy accuracy 0.691\n",
      "      ✔ Fold 4: Accuracy accuracy 0.784\n",
      "      ✔ Fold 5: Accuracy accuracy 0.753\n",
      "    📊 Accuracy CV Results: Accuracy 0.711±0.053\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ Neural_Standard: Test Return=-84.25%, Trades=220\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.639\n",
      "      ✔ Fold 2: Accuracy accuracy 0.825\n",
      "      ✔ Fold 3: Accuracy accuracy 0.649\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.763\n",
      "    📊 Accuracy CV Results: Accuracy 0.724±0.070\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1669% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1935% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5397% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5420% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-12.90%, Trades=30\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.742\n",
      "      ✔ Fold 2: Accuracy accuracy 0.742\n",
      "      ✔ Fold 3: Accuracy accuracy 0.660\n",
      "      ✔ Fold 4: Accuracy accuracy 0.825\n",
      "      ✔ Fold 5: Accuracy accuracy 0.773\n",
      "    📊 Accuracy CV Results: Accuracy 0.748±0.054\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1132% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.1137% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5042% cost\n",
      "    💰 TRY_USD: 3.0 pips × 0.0001 pip_value = 0.5244% cost\n",
      "    ✅ XGBoost_Standard: Test Return=-44.30%, Trades=205\n",
      "\n",
      "💱 Processing CNY_USD...\n",
      "    ✅ CNY_USD: Total=1565 days, Train=1173 days, Test=392 days\n",
      "       📅 Train: 2018-01-01 to 2022-06-29\n",
      "       📅 Test:  2022-06-30 to 2023-12-29\n",
      "📊 Loading macro data from: ml_tc_data_g.xlsx\n",
      "    ✔ Loaded 5y_tbill: 1509 rows\n",
      "    ✔ Loaded 13w_tbill: 1509 rows\n",
      "  📊 Running scenario: without_macro\n",
      "  ✅ Prepared features: 3 features, train=1171, test=390\n",
      "  📈 Buy-and-hold benchmark: Train=-2.86%, Test=-5.56%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.691\n",
      "      ✔ Fold 2: Accuracy accuracy 0.773\n",
      "      ✔ Fold 3: Accuracy accuracy 0.732\n",
      "      ✔ Fold 4: Accuracy accuracy 0.732\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.722±0.033\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    ✅ Logistic_Standard: Test Return=21.23%, Trades=210\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0103]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0022\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 1.5630\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0796\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5618, Standard intercept: -0.6075\n",
      "       MADL coef norm: 1.3416, Standard coef norm: 1.7449\n",
      "       Coefficient difference norm: 0.4033\n",
      "      ✔ Fold 1: MADL accuracy 0.691\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0111]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.8448\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0944\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5587, Standard intercept: -0.5427\n",
      "       MADL coef norm: 1.4479, Standard coef norm: 1.8819\n",
      "       Coefficient difference norm: 0.4341\n",
      "      ✔ Fold 2: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 1.9092\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0978\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5589, Standard intercept: -0.5107\n",
      "       MADL coef norm: 1.5636, Standard coef norm: 2.0444\n",
      "       Coefficient difference norm: 0.4810\n",
      "      ✔ Fold 3: MADL accuracy 0.722\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 2.1652\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1109\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.3132, Standard intercept: -0.3070\n",
      "       MADL coef norm: 1.5900, Standard coef norm: 2.0692\n",
      "       Coefficient difference norm: 0.4792\n",
      "      ✔ Fold 4: MADL accuracy 0.722\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0018\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0005, Total Loss = 2.1804\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1117\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2809, Standard intercept: -0.2570\n",
      "       MADL coef norm: 1.5716, Standard coef norm: 2.0426\n",
      "       Coefficient difference norm: 0.4712\n",
      "      ✔ Fold 5: MADL accuracy 0.670\n",
      "    📊 MADL CV Results: Accuracy 0.711±0.028\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0018\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0005, Total Loss = 2.1981\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1126\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.1880, Standard intercept: -0.2337\n",
      "       MADL coef norm: 1.5851, Standard coef norm: 2.0607\n",
      "       Coefficient difference norm: 0.4756\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    ✅ Logistic_MADL: Test Return=18.69%, Trades=213\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.670\n",
      "      ✔ Fold 2: Accuracy accuracy 0.784\n",
      "      ✔ Fold 3: Accuracy accuracy 0.660\n",
      "      ✔ Fold 4: Accuracy accuracy 0.680\n",
      "      ✔ Fold 5: Accuracy accuracy 0.670\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.046\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2016% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=17.13%, Trades=186\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.784\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.691\n",
      "      ✔ Fold 5: Accuracy accuracy 0.649\n",
      "    📊 Accuracy CV Results: Accuracy 0.709±0.043\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    ✅ RandomForest_Standard: Test Return=18.21%, Trades=210\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.670\n",
      "      ✔ Fold 2: Accuracy accuracy 0.753\n",
      "      ✔ Fold 3: Accuracy accuracy 0.691\n",
      "      ✔ Fold 4: Accuracy accuracy 0.670\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.693±0.031\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=20.08%, Trades=207\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.680\n",
      "      ✔ Fold 2: Accuracy accuracy 0.773\n",
      "      ✔ Fold 3: Accuracy accuracy 0.742\n",
      "      ✔ Fold 4: Accuracy accuracy 0.722\n",
      "      ✔ Fold 5: Accuracy accuracy 0.691\n",
      "    📊 Accuracy CV Results: Accuracy 0.722±0.034\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    ✅ Neural_Standard: Test Return=25.97%, Trades=185\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.680\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.639\n",
      "      ✔ Fold 4: Accuracy accuracy 0.680\n",
      "      ✔ Fold 5: Accuracy accuracy 0.619\n",
      "    📊 Accuracy CV Results: Accuracy 0.670±0.039\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1947% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2016% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=23.69%, Trades=100\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.773\n",
      "      ✔ Fold 3: Accuracy accuracy 0.763\n",
      "      ✔ Fold 4: Accuracy accuracy 0.711\n",
      "      ✔ Fold 5: Accuracy accuracy 0.670\n",
      "    📊 Accuracy CV Results: Accuracy 0.726±0.038\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1953% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    ✅ XGBoost_Standard: Test Return=19.53%, Trades=203\n",
      "  📊 Running scenario: with_macro\n",
      "    ✔ Added macro features (total features: 9)\n",
      "    ✔ Added macro features (total features: 9)\n",
      "  ✅ Prepared features: 9 features, train=1170, test=390\n",
      "  📈 Buy-and-hold benchmark: Train=-2.86%, Test=-5.56%\n",
      "  🤖 Testing Logistic...\n",
      "    🔧 Training Logistic_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.763\n",
      "      ✔ Fold 2: Accuracy accuracy 0.701\n",
      "      ✔ Fold 3: Accuracy accuracy 0.753\n",
      "      ✔ Fold 4: Accuracy accuracy 0.722\n",
      "      ✔ Fold 5: Accuracy accuracy 0.722\n",
      "    📊 Accuracy CV Results: Accuracy 0.732±0.023\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2016% cost\n",
      "    ✅ Logistic_Standard: Test Return=19.83%, Trades=198\n",
      "    🔧 Training Logistic_MADL...\n",
      "    🎯 Running 5-fold proper CV with MADL scorer...\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0103]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0022\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0009, Total Loss = 1.5393\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.0784\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.6178, Standard intercept: -0.6341\n",
      "       MADL coef norm: 1.3219, Standard coef norm: 1.7194\n",
      "       Coefficient difference norm: 0.3980\n",
      "      ✔ Fold 1: MADL accuracy 0.753\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0111]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0020\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 1.9935\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1021\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5933, Standard intercept: -0.5801\n",
      "       MADL coef norm: 1.4716, Standard coef norm: 1.9099\n",
      "       Coefficient difference norm: 0.4388\n",
      "      ✔ Fold 2: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0020\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 1.9550\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1000\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.5024, Standard intercept: -0.5191\n",
      "       MADL coef norm: 1.5484, Standard coef norm: 2.0230\n",
      "       Coefficient difference norm: 0.4755\n",
      "      ✔ Fold 3: MADL accuracy 0.763\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0019\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0007, Total Loss = 2.2369\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1145\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2834, Standard intercept: -0.3115\n",
      "       MADL coef norm: 1.5914, Standard coef norm: 2.0698\n",
      "       Coefficient difference norm: 0.4790\n",
      "      ✔ Fold 4: MADL accuracy 0.711\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0018\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 2.1914\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1122\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2384, Standard intercept: -0.2641\n",
      "       MADL coef norm: 1.5722, Standard coef norm: 2.0432\n",
      "       Coefficient difference norm: 0.4712\n",
      "      ✔ Fold 5: MADL accuracy 0.680\n",
      "    📊 MADL CV Results: Accuracy 0.724±0.030\n",
      "    Optimizing Logistic with 5-fold time series CV...\n",
      "    MADL optimization enabled: True\n",
      "    🚀 Using TRUE MADL implementation for Logistic Regression\n",
      "    📊 MADL Logistic: Using actual returns, range: [0.0000, 0.0153]\n",
      "    📊 MADL Logistic: Mean return magnitude: 0.0018\n",
      "    📊 MADL Logistic: Std return magnitude: 0.0019\n",
      "    🔧 Optimizing MADL loss function using custom gradient descent...\n",
      "      Iteration 0: MADL Loss = -0.0006, Total Loss = 2.2392\n",
      "      ⚠️ Warning: Weights too small, resetting to best known solution\n",
      "      ⚠️ Warning: Converged to near-zero solution. Blending with standard solution...\n",
      "    ✓ MADL optimization completed! Final loss: 0.1147\n",
      "    📊 MADL vs Standard coefficient comparison:\n",
      "       MADL intercept: -0.2250, Standard intercept: -0.2413\n",
      "       MADL coef norm: 1.5900, Standard coef norm: 2.0671\n",
      "       Coefficient difference norm: 0.4774\n",
      "    ✓ Logistic Regression trained with TRUE MADL objective\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1958% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2016% cost\n",
      "    ✅ Logistic_MADL: Test Return=24.40%, Trades=190\n",
      "  🤖 Testing DecisionTree...\n",
      "    🔧 Training DecisionTree_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.526\n",
      "      ✔ Fold 2: Accuracy accuracy 0.763\n",
      "      ✔ Fold 3: Accuracy accuracy 0.495\n",
      "      ✔ Fold 4: Accuracy accuracy 0.649\n",
      "      ✔ Fold 5: Accuracy accuracy 0.649\n",
      "    📊 Accuracy CV Results: Accuracy 0.616±0.097\n",
      "    Optimizing DecisionTree with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2016% cost\n",
      "    ✅ DecisionTree_Standard: Test Return=8.26%, Trades=192\n",
      "  🤖 Testing RandomForest...\n",
      "    🔧 Training RandomForest_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.732\n",
      "      ✔ Fold 2: Accuracy accuracy 0.763\n",
      "      ✔ Fold 3: Accuracy accuracy 0.660\n",
      "      ✔ Fold 4: Accuracy accuracy 0.742\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.715±0.039\n",
      "    Optimizing RandomForest with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2016% cost\n",
      "    ✅ RandomForest_Standard: Test Return=15.66%, Trades=244\n",
      "  🤖 Testing GradientBoosting...\n",
      "    🔧 Training GradientBoosting_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.639\n",
      "      ✔ Fold 2: Accuracy accuracy 0.732\n",
      "      ✔ Fold 3: Accuracy accuracy 0.701\n",
      "      ✔ Fold 4: Accuracy accuracy 0.670\n",
      "      ✔ Fold 5: Accuracy accuracy 0.691\n",
      "    📊 Accuracy CV Results: Accuracy 0.687±0.031\n",
      "    Optimizing GradientBoosting with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2016% cost\n",
      "    ✅ GradientBoosting_Standard: Test Return=18.46%, Trades=206\n",
      "  🤖 Testing Neural...\n",
      "    🔧 Training Neural_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.567\n",
      "      ✔ Fold 2: Accuracy accuracy 0.701\n",
      "      ✔ Fold 3: Accuracy accuracy 0.598\n",
      "      ✔ Fold 4: Accuracy accuracy 0.608\n",
      "      ✔ Fold 5: Accuracy accuracy 0.619\n",
      "    📊 Accuracy CV Results: Accuracy 0.619±0.045\n",
      "    Optimizing Neural with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1958% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2016% cost\n",
      "    ✅ Neural_Standard: Test Return=-9.37%, Trades=153\n",
      "  🤖 Testing AdaBoost...\n",
      "    🔧 Training AdaBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.546\n",
      "      ✔ Fold 2: Accuracy accuracy 0.567\n",
      "      ✔ Fold 3: Accuracy accuracy 0.660\n",
      "      ✔ Fold 4: Accuracy accuracy 0.588\n",
      "      ✔ Fold 5: Accuracy accuracy 0.629\n",
      "    📊 Accuracy CV Results: Accuracy 0.598±0.041\n",
      "    Optimizing AdaBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1947% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2031% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2026% cost\n",
      "    ✅ AdaBoost_Standard: Test Return=-2.46%, Trades=70\n",
      "  🤖 Testing XGBoost...\n",
      "    🔧 Training XGBoost_Standard...\n",
      "    🎯 Running 5-fold proper CV with Accuracy scorer...\n",
      "      ✔ Fold 1: Accuracy accuracy 0.711\n",
      "      ✔ Fold 2: Accuracy accuracy 0.722\n",
      "      ✔ Fold 3: Accuracy accuracy 0.711\n",
      "      ✔ Fold 4: Accuracy accuracy 0.660\n",
      "      ✔ Fold 5: Accuracy accuracy 0.680\n",
      "    📊 Accuracy CV Results: Accuracy 0.697±0.023\n",
      "    Optimizing XGBoost with 5-fold time series CV...\n",
      "    MADL optimization enabled: False\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1948% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.1951% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2010% cost\n",
      "    💰 CNY_USD: 3.0 pips × 0.0001 pip_value = 0.2011% cost\n",
      "    ✅ XGBoost_Standard: Test Return=24.87%, Trades=199\n",
      "\n",
      "📊 Period 4 completed: 128 successful model runs\n",
      "\n",
      "================================================================================\n",
      "🎯 FINAL RESULTS SUMMARY\n",
      "================================================================================\n",
      "📈 Total successful model runs: 512\n",
      "📊 Currencies tested: 8\n",
      "🤖 Models tested: 8\n",
      "🔮 Periods tested: 4\n",
      "\n",
      "🏆 TOP 10 PERFORMERS (Test Period Returns):\n",
      "--------------------------------------------------\n",
      "Logistic_MADL        AUD_USD  with_macro   Return: 579.81% Sharpe:  9.39 Trades: 237 Stability: 0.803\n",
      "Logistic_MADL        AUD_USD  without_macro Return: 555.44% Sharpe:  9.07 Trades: 231 Stability: 0.803\n",
      "Neural_Standard      AUD_USD  without_macro Return: 543.12% Sharpe:  8.91 Trades: 225 Stability: 0.804\n",
      "Logistic_Standard    AUD_USD  without_macro Return: 534.33% Sharpe:  8.82 Trades: 225 Stability: 0.803\n",
      "RandomForest_Standard AUD_USD  without_macro Return: 518.86% Sharpe:  8.77 Trades: 233 Stability: 0.803\n",
      "GradientBoosting_Standard AUD_USD  without_macro Return: 493.58% Sharpe:  9.22 Trades: 270 Stability: 0.803\n",
      "XGBoost_Standard     AUD_USD  without_macro Return: 491.36% Sharpe:  9.22 Trades: 266 Stability: 0.804\n",
      "DecisionTree_Standard AUD_USD  without_macro Return: 477.74% Sharpe:  8.15 Trades: 200 Stability: 0.810\n",
      "Logistic_Standard    CHF_USD  with_macro   Return: 468.49% Sharpe: 11.22 Trades: 209 Stability: 0.804\n",
      "Neural_Standard      CHF_USD  without_macro Return: 466.73% Sharpe: 11.17 Trades: 208 Stability: 0.804\n",
      "\n",
      "🔬 MADL vs STANDARD COMPARISON:\n",
      "----------------------------------------\n",
      "MADL Performance:\n",
      "         test_total_return                test_sharpe        cv_accuracy_mean  \\\n",
      "                      mean      std count        mean    std             mean   \n",
      "use_madl                                                                        \n",
      "False               64.943  128.303    64       8.647  2.993            0.734   \n",
      "True                76.424  140.313    64       8.775  2.322            0.721   \n",
      "\n",
      "                outperform_benchmark_test  \n",
      "            std                      mean  \n",
      "use_madl                                   \n",
      "False     0.031                     0.797  \n",
      "True      0.035                     0.828  \n",
      "\n",
      "💱 BEST MODEL BY CURRENCY:\n",
      "-----------------------------------\n",
      "AUD_USD  Logistic_MADL        Return: 579.81% Sharpe:  9.39 Beat Benchmark: ✅\n",
      "CHF_USD  Logistic_Standard    Return: 468.49% Sharpe: 11.22 Beat Benchmark: ✅\n",
      "CNY_USD  Neural_Standard      Return:  25.97% Sharpe:  8.56 Beat Benchmark: ✅\n",
      "EUR_USD  Logistic_MADL        Return: 397.88% Sharpe: 10.29 Beat Benchmark: ✅\n",
      "JPY_USD  Neural_Standard      Return: 239.36% Sharpe:  9.06 Beat Benchmark: ✅\n",
      "MXN_USD  Logistic_MADL        Return:  16.34% Sharpe: 10.77 Beat Benchmark: ✅\n",
      "TRY_USD  Logistic_MADL        Return: 148.50% Sharpe:  4.92 Beat Benchmark: ✅\n",
      "ZAR_USD  Neural_Standard      Return:  44.99% Sharpe: 10.93 Beat Benchmark: ✅\n",
      "\n",
      "📊 MACRO DATA IMPACT:\n",
      "-------------------------\n",
      "              test_total_return          test_sharpe         \\\n",
      "                           mean      std        mean    std   \n",
      "include_macro                                                 \n",
      "False                    59.353  125.934       8.017  2.989   \n",
      "True                     48.786  109.930       7.144  2.984   \n",
      "\n",
      "              outperform_benchmark_test  \n",
      "                                   mean  \n",
      "include_macro                            \n",
      "False                             0.773  \n",
      "True                              0.719  \n",
      "\n",
      "💾 Results saved to: ml_trading_results_20250612_054213.csv\n",
      "\n",
      "📋 OVERALL STATISTICS:\n",
      "-------------------------\n",
      "Average Test Return: 54.07% ± 118.21%\n",
      "Average Sharpe Ratio: 7.580 ± 3.015\n",
      "Benchmark Outperformance: 74.6% of models\n",
      "Average Stability Score: 0.819\n",
      "Average Trade Frequency: 124.6 trades/year\n",
      "\n",
      "🎉 Analysis complete!\n",
      "================================================================================\n"
     ]
    }
   ],
   "source": [
    "# ========== MAIN EXECUTION PIPELINE ==========\n",
    "# Run this after loading all the functions above\n",
    "\n",
    "print(\"🚀 Starting comprehensive ML trading system analysis...\")\n",
    "print(\"=\"*80)\n",
    "\n",
    "# ========== CONFIGURATION ==========\n",
    "# Models to test\n",
    "MODEL_CONFIG = {\n",
    "    'Logistic': LogisticRegression,\n",
    "    'DecisionTree': DecisionTreeClassifier,\n",
    "    'RandomForest': RandomForestClassifier,\n",
    "    'GradientBoosting': GradientBoostingClassifier,\n",
    "    'Neural': MLPClassifier,\n",
    "    'AdaBoost': AdaBoostClassifier,\n",
    "    'XGBoost': XGBClassifier\n",
    "}\n",
    "\n",
    "# Get hyperparameter grids\n",
    "PARAM_GRIDS = get_hyperparameter_grids()\n",
    "\n",
    "# Results storage\n",
    "all_results = []\n",
    "summary_stats = {}\n",
    "\n",
    "# ========== MAIN ANALYSIS LOOP ==========\n",
    "for period_idx, (train_start, train_end) in enumerate(PERIODS):\n",
    "    print(f\"\\n📍 PERIOD {period_idx + 1}: Training {train_start} to {train_end}\")\n",
    "    print(\"-\" * 60)\n",
    "    \n",
    "    period_results = []\n",
    "    \n",
    "    for currency_pair in CURRENCY_PAIRS:\n",
    "        print(f\"\\n💱 Processing {currency_pair}...\")\n",
    "        \n",
    "        try:\n",
    "            # Load and split forex data based on actual available data\n",
    "            forex_train, forex_test = load_and_split_forex_data(\n",
    "                FOREX_FILE, currency_pair, train_start, train_end, train_ratio=0.75\n",
    "            )\n",
    "\n",
    "            if forex_train is None or forex_test is None:\n",
    "                print(f\"  ❌ Could not load/split data for {currency_pair}\")\n",
    "                continue\n",
    "\n",
    "            if len(forex_train) < 50 or len(forex_test) < 10:\n",
    "                print(f\"  ⚠️ Insufficient data after split: train={len(forex_train)}, test={len(forex_test)}\")\n",
    "                continue\n",
    "\n",
    "            # Try to load macro data\n",
    "            macro_data = load_macro_data_from_ml_tc_data_d(MACRO_FILE, train_start, train_end)\n",
    "            \n",
    "            # Test both with and without macro data\n",
    "            for include_macro in [False, True]:\n",
    "                if include_macro and macro_data is None:\n",
    "                    print(f\"  ⚠️ Skipping macro analysis - no macro data available\")\n",
    "                    continue\n",
    "                \n",
    "                scenario_name = \"with_macro\" if include_macro else \"without_macro\"\n",
    "                print(f\"  📊 Running scenario: {scenario_name}\")\n",
    "                \n",
    "                try:\n",
    "                    # Prepare features\n",
    "                    features_train = prepare_features(forex_train, macro_data, include_macro)\n",
    "                    features_test = prepare_features(forex_test, macro_data, include_macro)\n",
    "                    \n",
    "                    # Create targets as per paper: Close_{t+1} > Open_t (tomorrow's close vs today's open)\n",
    "                    target_train = (forex_train['Close'].shift(-1) > forex_train['Open']).astype(int)\n",
    "                    target_test = (forex_test['Close'].shift(-1) > forex_test['Open']).astype(int)\n",
    "                    \n",
    "                    # Calculate returns for MADL\n",
    "                    returns_train = (forex_train['Close'].shift(-1) - forex_train['Open'].shift(-1)) / forex_train['Open'].shift(-1)\n",
    "                    returns_test = (forex_test['Close'].shift(-1) - forex_test['Open'].shift(-1)) / forex_test['Open'].shift(-1)\n",
    "                    \n",
    "                    # Remove last row (no test data for target)\n",
    "                    features_train = features_train.iloc[:-1]\n",
    "                    target_train = target_train.iloc[:-1]\n",
    "                    returns_train = returns_train.iloc[:-1]\n",
    "                    \n",
    "                    features_test = features_test.iloc[:-1]\n",
    "                    target_test = target_test.iloc[:-1]\n",
    "                    returns_test = returns_test.iloc[:-1]\n",
    "                    \n",
    "                    # Remove NaN values\n",
    "                    valid_idx_train = ~(features_train.isnull().any(axis=1) | target_train.isnull() | returns_train.isnull())\n",
    "                    features_train = features_train[valid_idx_train]\n",
    "                    target_train = target_train[valid_idx_train]\n",
    "                    returns_train = returns_train[valid_idx_train]\n",
    "                    \n",
    "                    valid_idx_test = ~(features_test.isnull().any(axis=1) | target_test.isnull() | returns_test.isnull())\n",
    "                    features_test = features_test[valid_idx_test]\n",
    "                    target_test = target_test[valid_idx_test]\n",
    "                    returns_test = returns_test[valid_idx_test]\n",
    "                    \n",
    "                    if len(features_train) < 50 or len(features_test) < 10:\n",
    "                        print(f\"  ⚠️ Insufficient clean data: train={len(features_train)}, test={len(features_test)}\")\n",
    "                        continue\n",
    "                    \n",
    "                    # Scale features\n",
    "                    scaler = StandardScaler()\n",
    "                    X_train_scaled = scaler.fit_transform(features_train)\n",
    "                    X_test_scaled = scaler.transform(features_test)\n",
    "                    \n",
    "                    print(f\"  ✅ Prepared features: {X_train_scaled.shape[1]} features, train={len(X_train_scaled)}, test={len(X_test_scaled)}\")\n",
    "                    \n",
    "                    # Calculate buy-and-hold benchmark\n",
    "                    benchmark_train = calculate_buy_and_hold_benchmark(\n",
    "                        forex_train['Open'], forex_train['Close']\n",
    "                    )\n",
    "                    benchmark_test = calculate_buy_and_hold_benchmark(\n",
    "                        forex_test['Open'], forex_test['Close']\n",
    "                    )\n",
    "                    \n",
    "                    print(f\"  📈 Buy-and-hold benchmark: Train={benchmark_train['total_return']:.2f}%, Test={benchmark_test['total_return']:.2f}%\")\n",
    "                    \n",
    "                    # Test each model\n",
    "                    for model_name, model_class in MODEL_CONFIG.items():\n",
    "                        print(f\"  🤖 Testing {model_name}...\")\n",
    "                        \n",
    "                        # Test both standard and MADL versions (only for Logistic Regression)\n",
    "                        test_madl = (model_name == 'Logistic')\n",
    "                        madl_variants = [False, True] if test_madl else [False]\n",
    "                        \n",
    "                        for use_madl in madl_variants:\n",
    "                            variant_name = f\"{model_name}_MADL\" if use_madl else f\"{model_name}_Standard\"\n",
    "                            print(f\"    🔧 Training {variant_name}...\")\n",
    "                            \n",
    "                            try:\n",
    "                                # Create appropriate scorer\n",
    "                                if use_madl:\n",
    "                                    scorer = make_madl_scorer_with_returns(returns_train.values)\n",
    "                                    scorer_name = \"MADL\"\n",
    "                                else:\n",
    "                                    scorer = accuracy_scorer\n",
    "                                    scorer_name = \"Accuracy\"\n",
    "                                \n",
    "                                # Cross-validation\n",
    "                                cv_results = proper_time_series_validation(\n",
    "                                    features_train.values, target_train, model_class, \n",
    "                                    PARAM_GRIDS.get(model_name, {}), scorer, scorer_name,\n",
    "                                    n_splits=5, returns_magnitude=returns_train.values if use_madl else None\n",
    "                                )\n",
    "                                \n",
    "                                # Train final model\n",
    "                                final_model, best_params, best_score = train_model_with_optimization(\n",
    "                                    X_train_scaled, target_train, model_name, model_class,\n",
    "                                    PARAM_GRIDS.get(model_name, {}), scorer, cv_folds=5, n_iter=10,\n",
    "                                    returns_magnitude=returns_train.values, use_madl_weights=use_madl\n",
    "                                )\n",
    "                                \n",
    "                                # Backtest on training period\n",
    "                                train_backtest = detailed_backtest_with_trade_analysis(\n",
    "                                    final_model, X_train_scaled, \n",
    "                                    forex_train['Open'].iloc[:-1][valid_idx_train],\n",
    "                                    forex_train['Close'].iloc[:-1][valid_idx_train],\n",
    "                                    currency_pair, base_threshold=0.55\n",
    "                                )\n",
    "                                \n",
    "                                # Backtest on test period\n",
    "                                test_backtest = detailed_backtest_with_trade_analysis(\n",
    "                                    final_model, X_test_scaled,\n",
    "                                    forex_test['Open'].iloc[:-1][valid_idx_test],\n",
    "                                    forex_test['Close'].iloc[:-1][valid_idx_test],\n",
    "                                    currency_pair, base_threshold=0.55\n",
    "                                )\n",
    "                                \n",
    "                                # Calculate stability\n",
    "                                stability_score = calculate_stability(final_model, X_test_scaled, target_test)\n",
    "                                \n",
    "                                # Store results\n",
    "                                result = {\n",
    "                                    'period': f\"{train_start}_{train_end}\",\n",
    "                                    'period_idx': period_idx + 1,\n",
    "                                    'currency_pair': currency_pair,\n",
    "                                    'scenario': scenario_name,\n",
    "                                    'model': variant_name,\n",
    "                                    'use_madl': use_madl,\n",
    "                                    'include_macro': include_macro,\n",
    "                                    'n_features': X_train_scaled.shape[1],\n",
    "                                    'train_samples': len(X_train_scaled),\n",
    "                                    'test_samples': len(X_test_scaled),\n",
    "                                    \n",
    "                                    # CV Results\n",
    "                                    'cv_accuracy_mean': cv_results['cv_accuracy_mean'],\n",
    "                                    'cv_accuracy_std': cv_results['cv_accuracy_std'],\n",
    "                                    'cv_folds_completed': cv_results['cv_folds_completed'],\n",
    "                                    \n",
    "                                    # Training Performance\n",
    "                                    'train_total_return': train_backtest['total_return'],\n",
    "                                    'train_sharpe': train_backtest['sharpe'],\n",
    "                                    'train_sortino': train_backtest['sortino'],\n",
    "                                    'train_max_drawdown': train_backtest['max_drawdown'],\n",
    "                                    'train_trades': train_backtest['trades'],\n",
    "                                    'train_trade_frequency': train_backtest['trade_frequency'],\n",
    "                                    \n",
    "                                    # Test Performance\n",
    "                                    'test_total_return': test_backtest['total_return'],\n",
    "                                    'test_sharpe': test_backtest['sharpe'],\n",
    "                                    'test_sortino': test_backtest['sortino'],\n",
    "                                    'test_max_drawdown': test_backtest['max_drawdown'],\n",
    "                                    'test_trades': test_backtest['trades'],\n",
    "                                    'test_trade_frequency': test_backtest['trade_frequency'],\n",
    "                                    'test_cvar_95': test_backtest['cvar_95'],\n",
    "                                    'test_avg_signal_strength': test_backtest['avg_signal_strength'],\n",
    "                                    \n",
    "                                    # Benchmark Comparison\n",
    "                                    'benchmark_train_return': benchmark_train['total_return'],\n",
    "                                    'benchmark_test_return': benchmark_test['total_return'],\n",
    "                                    'outperform_benchmark_train': train_backtest['total_return'] > benchmark_train['total_return'],\n",
    "                                    'outperform_benchmark_test': test_backtest['total_return'] > benchmark_test['total_return'],\n",
    "                                    \n",
    "                                    # Model Stability\n",
    "                                    'stability_score': stability_score,\n",
    "                                    \n",
    "                                    # Transaction Costs\n",
    "                                    'transaction_cost_pct': test_backtest['transaction_cost_pct'],\n",
    "                                    'spread_pips': test_backtest['spread_pips'],\n",
    "                                    \n",
    "                                    # Best Parameters\n",
    "                                    'best_params': str(best_params),\n",
    "                                    'best_cv_score': best_score\n",
    "                                }\n",
    "                                \n",
    "                                all_results.append(result)\n",
    "                                period_results.append(result)\n",
    "                                \n",
    "                                print(f\"    ✅ {variant_name}: Test Return={test_backtest['total_return']:.2f}%, Trades={test_backtest['trades']}\")\n",
    "                                \n",
    "                            except Exception as e:\n",
    "                                print(f\"    ❌ {variant_name} failed: {str(e)[:50]}...\")\n",
    "                                continue\n",
    "                    \n",
    "                except Exception as e:\n",
    "                    print(f\"  ❌ Feature preparation failed for {currency_pair} {scenario_name}: {str(e)[:50]}...\")\n",
    "                    continue\n",
    "        \n",
    "        except Exception as e:\n",
    "            print(f\"  ❌ Data loading failed for {currency_pair}: {str(e)[:50]}...\")\n",
    "            continue\n",
    "    \n",
    "    print(f\"\\n📊 Period {period_idx + 1} completed: {len(period_results)} successful model runs\")\n",
    "\n",
    "# ========== RESULTS ANALYSIS ==========\n",
    "print(f\"\\n\" + \"=\"*80)\n",
    "print(f\"🎯 FINAL RESULTS SUMMARY\")\n",
    "print(f\"=\"*80)\n",
    "\n",
    "if len(all_results) > 0:\n",
    "    # Convert to DataFrame\n",
    "    results_df = pd.DataFrame(all_results)\n",
    "    \n",
    "    print(f\"📈 Total successful model runs: {len(results_df)}\")\n",
    "    print(f\"📊 Currencies tested: {results_df['currency_pair'].nunique()}\")\n",
    "    print(f\"🤖 Models tested: {results_df['model'].nunique()}\")\n",
    "    print(f\"🔮 Periods tested: {results_df['period_idx'].nunique()}\")\n",
    "    \n",
    "    # Top performers by test returns\n",
    "    print(f\"\\n🏆 TOP 10 PERFORMERS (Test Period Returns):\")\n",
    "    print(\"-\" * 50)\n",
    "    top_performers = results_df.nlargest(10, 'test_total_return')[\n",
    "        ['model', 'currency_pair', 'scenario', 'test_total_return', 'test_sharpe', 'test_trades', 'stability_score']\n",
    "    ]\n",
    "    for idx, row in top_performers.iterrows():\n",
    "        print(f\"{row['model']:<20} {row['currency_pair']:<8} {row['scenario']:<12} \"\n",
    "              f\"Return: {row['test_total_return']:>6.2f}% \"\n",
    "              f\"Sharpe: {row['test_sharpe']:>5.2f} \"\n",
    "              f\"Trades: {row['test_trades']:>3.0f} \"\n",
    "              f\"Stability: {row['stability_score']:>5.3f}\")\n",
    "    \n",
    "    # MADL vs Standard comparison\n",
    "    print(f\"\\n🔬 MADL vs STANDARD COMPARISON:\")\n",
    "    print(\"-\" * 40)\n",
    "    madl_comparison = results_df[results_df['model'].str.contains('Logistic')].groupby('use_madl').agg({\n",
    "        'test_total_return': ['mean', 'std', 'count'],\n",
    "        'test_sharpe': ['mean', 'std'],\n",
    "        'cv_accuracy_mean': ['mean', 'std'],\n",
    "        'outperform_benchmark_test': 'mean'\n",
    "    }).round(3)\n",
    "    \n",
    "    print(\"MADL Performance:\")\n",
    "    print(madl_comparison)\n",
    "    \n",
    "    # Best model by currency\n",
    "    print(f\"\\n💱 BEST MODEL BY CURRENCY:\")\n",
    "    print(\"-\" * 35)\n",
    "    best_by_currency = results_df.loc[results_df.groupby('currency_pair')['test_total_return'].idxmax()][\n",
    "        ['currency_pair', 'model', 'test_total_return', 'test_sharpe', 'outperform_benchmark_test']\n",
    "    ]\n",
    "    for idx, row in best_by_currency.iterrows():\n",
    "        benchmark_beat = \"✅\" if row['outperform_benchmark_test'] else \"❌\"\n",
    "        print(f\"{row['currency_pair']:<8} {row['model']:<20} Return: {row['test_total_return']:>6.2f}% \"\n",
    "              f\"Sharpe: {row['test_sharpe']:>5.2f} Beat Benchmark: {benchmark_beat}\")\n",
    "    \n",
    "    # Macro data impact\n",
    "    if results_df['include_macro'].nunique() > 1:\n",
    "        print(f\"\\n📊 MACRO DATA IMPACT:\")\n",
    "        print(\"-\" * 25)\n",
    "        macro_impact = results_df.groupby('include_macro').agg({\n",
    "            'test_total_return': ['mean', 'std'],\n",
    "            'test_sharpe': ['mean', 'std'],\n",
    "            'outperform_benchmark_test': 'mean'\n",
    "        }).round(3)\n",
    "        print(macro_impact)\n",
    "    \n",
    "    # Save results\n",
    "    timestamp = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\n",
    "    results_filename = f\"ml_trading_results_{timestamp}.csv\"\n",
    "    results_df.to_csv(results_filename, index=False)\n",
    "    print(f\"\\n💾 Results saved to: {results_filename}\")\n",
    "    \n",
    "    # Display final summary statistics\n",
    "    print(f\"\\n📋 OVERALL STATISTICS:\")\n",
    "    print(\"-\" * 25)\n",
    "    print(f\"Average Test Return: {results_df['test_total_return'].mean():.2f}% ± {results_df['test_total_return'].std():.2f}%\")\n",
    "    print(f\"Average Sharpe Ratio: {results_df['test_sharpe'].mean():.3f} ± {results_df['test_sharpe'].std():.3f}\")\n",
    "    print(f\"Benchmark Outperformance: {results_df['outperform_benchmark_test'].mean()*100:.1f}% of models\")\n",
    "    print(f\"Average Stability Score: {results_df['stability_score'].mean():.3f}\")\n",
    "    print(f\"Average Trade Frequency: {results_df['test_trade_frequency'].mean():.1f} trades/year\")\n",
    "    \n",
    "else:\n",
    "    print(\"❌ No successful model runs completed. Please check your data files and parameters.\")\n",
    "\n",
    "print(f\"\\n🎉 Analysis complete!\")\n",
    "print(\"=\"*80)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "64361d32-6765-444b-8d23-1683499d5279",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "88ebfaf4-5516-4509-80b7-7b4b8a019de4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading Excel file...\n",
      "Loaded 512 rows\n",
      "\n",
      "Before fixing - Example of problematic rows:\n",
      "   currency_pair                  model  test_total_return  test_sharpe  \\\n",
      "30       JPY_USD      AdaBoost_Standard          -0.903449     0.253864   \n",
      "64       MXN_USD      Logistic_Standard         -40.567223     8.549621   \n",
      "65       MXN_USD          Logistic_MADL         -39.981701     8.391175   \n",
      "66       MXN_USD  DecisionTree_Standard         -37.286351     7.796770   \n",
      "67       MXN_USD  RandomForest_Standard         -46.897275     7.341226   \n",
      "\n",
      "    test_sortino  \n",
      "30      0.436035  \n",
      "64     21.680661  \n",
      "65     20.710698  \n",
      "66     21.482463  \n",
      "67     23.484371  \n",
      "\n",
      "After fixing - Same rows:\n",
      "   currency_pair                  model  test_total_return  test_sharpe_fixed  \\\n",
      "30       JPY_USD      AdaBoost_Standard          -0.903449          -0.253864   \n",
      "64       MXN_USD      Logistic_Standard         -40.567223          -8.549621   \n",
      "65       MXN_USD          Logistic_MADL         -39.981701          -8.391175   \n",
      "66       MXN_USD  DecisionTree_Standard         -37.286351          -7.796770   \n",
      "67       MXN_USD  RandomForest_Standard         -46.897275          -7.341226   \n",
      "\n",
      "    test_sortino_fixed  \n",
      "30           -0.436035  \n",
      "64          -21.680661  \n",
      "65          -20.710698  \n",
      "66          -21.482463  \n",
      "67          -23.484371  \n",
      "\n",
      "Saved fixed results to: ml_trading_results_FIXED.xlsx\n",
      "Total rows processed: 512\n",
      "Rows with negative returns fixed: 139\n"
     ]
    }
   ],
   "source": [
    "#FIXING SHARPE AND SORTINO RATIOS\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "# Load your Excel\n",
    "print(\"Loading Excel file...\")\n",
    "df = pd.read_excel('ml_trading_results_20250612_054213.xlsx')\n",
    "print(f\"Loaded {len(df)} rows\")\n",
    "\n",
    "# Show before fixing\n",
    "print(\"\\nBefore fixing - Example of problematic rows:\")\n",
    "problematic = df[df['test_total_return'] < 0][['currency_pair', 'model', 'test_total_return', 'test_sharpe', 'test_sortino']].head()\n",
    "print(problematic)\n",
    "\n",
    "# Fix Sharpe\n",
    "rf_adjustment = 0.4  # Approximate RF impact\n",
    "df['test_sharpe_fixed'] = np.where(\n",
    "    df['test_total_return'] < 0,\n",
    "    -np.abs(df['test_sharpe']),\n",
    "    df['test_sharpe'] - rf_adjustment\n",
    ")\n",
    "\n",
    "# Fix Sortino  \n",
    "df['test_sortino_fixed'] = np.where(\n",
    "    df['test_total_return'] < 0,\n",
    "    -np.abs(df['test_sortino']),\n",
    "    df['test_sortino']\n",
    ")\n",
    "\n",
    "# Show after fixing\n",
    "print(\"\\nAfter fixing - Same rows:\")\n",
    "print(df[df['test_total_return'] < 0][['currency_pair', 'model', 'test_total_return', 'test_sharpe_fixed', 'test_sortino_fixed']].head())\n",
    "\n",
    "# Replace original columns with fixed versions\n",
    "df['test_sharpe'] = df['test_sharpe_fixed']\n",
    "df['test_sortino'] = df['test_sortino_fixed']\n",
    "\n",
    "# Drop the temporary columns\n",
    "df = df.drop(['test_sharpe_fixed', 'test_sortino_fixed'], axis=1)\n",
    "\n",
    "# Save back\n",
    "output_file = 'ml_trading_results_FIXED.xlsx'\n",
    "df.to_excel(output_file, index=False)\n",
    "print(f\"\\nSaved fixed results to: {output_file}\")\n",
    "print(f\"Total rows processed: {len(df)}\")\n",
    "print(f\"Rows with negative returns fixed: {len(df[df['test_total_return'] < 0])}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "658d5324-6b45-4172-be55-62d6cb09a7cb",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "4df746a9-62dc-4978-87ad-ed77d104527b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "✅ Enhanced export functions loaded!\n",
      "\n",
      "🚀 Key improvements:\n",
      "  📈 Complete benchmark data export (benchmark_test_return, outperform_benchmark_test)\n",
      "  📅 Period information preserved and analyzed\n",
      "  💰 Transaction cost data fully exported\n",
      "  📊 All columns needed for standalone analysis preserved\n",
      "  📁 Individual CSV exports for flexible analysis\n",
      "\n",
      "💡 SIMPLE USAGE:\n",
      "  timestamp = export_all_results_simple(results_df)\n",
      "\n",
      "💡 Or use export_data_for_standalone_analysis() for just CSV files\n",
      "📊 Loading fixed results data...\n",
      "✅ Loaded 512 rows from FIXED file\n",
      "\n",
      "🔍 Verifying Sharpe/Sortino fixes:\n",
      "Sample of fixed negative return cases:\n",
      "   currency_pair              model  test_total_return  test_sharpe  \\\n",
      "30       JPY_USD  AdaBoost_Standard          -0.903449    -0.253864   \n",
      "64       MXN_USD  Logistic_Standard         -40.567223    -8.549621   \n",
      "65       MXN_USD      Logistic_MADL         -39.981701    -8.391175   \n",
      "\n",
      "    test_sortino  \n",
      "30     -0.436035  \n",
      "64    -21.680661  \n",
      "65    -20.710698  \n",
      "✅ All negative returns now have negative Sharpe ratios!\n",
      "\n",
      "🚀 Starting comprehensive export...\n",
      "\n",
      "📊 Simple Export - Checking available columns:\n",
      "  ✅ benchmark_test_return\n",
      "  ✅ outperform_benchmark_test\n",
      "  ✅ transaction_cost_pct\n",
      "  ✅ spread_pips\n",
      "  ✅ test_trades\n",
      "  ✅ period\n",
      "  ✅ cv_accuracy_mean\n",
      "  ✅ cv_accuracy_std\n",
      "\n",
      "✅ Complete results exported to: complete_results_data_20250612_060033.csv\n",
      "✅ Comprehensive Excel file: comprehensive_analysis_20250612_060033.xlsx\n",
      "\n",
      "📁 Exporting data files for standalone analysis...\n",
      "✅ Complete results data exported\n",
      "✅ Model summary with benchmark exported\n",
      "✅ Currency summary exported\n",
      "✅ Period summary exported\n",
      "✅ Model-currency performance matrix exported\n",
      "✅ Benchmark comparison exported\n",
      "\n",
      "📊 All data files exported with timestamp: 20250612_060033\n",
      "\n",
      "🎉 All data exported successfully!\n",
      "📁 Files created:\n",
      "  • complete_results_data_20250612_060033.csv (for standalone analysis)\n",
      "  • comprehensive_analysis_20250612_060033.xlsx (with multiple sheets)\n",
      "  • Various individual CSV files\n",
      "\n",
      "✅ Export completed successfully!\n",
      "📁 All files created with timestamp: 20250612_060033\n",
      "\n",
      "📊 MADL vs Standard Logistic Comparison:\n",
      "\n",
      "MADL Performance Summary:\n",
      "         test_total_return                test_sharpe         test_sortino  \\\n",
      "                      mean      std count        mean    std          mean   \n",
      "use_madl                                                                     \n",
      "False               64.943  128.303    64       4.753  7.518  1.885222e+15   \n",
      "True                76.424  140.313    64       5.299  7.027  1.327800e+01   \n",
      "\n",
      "                       test_trades outperform_benchmark_test  \n",
      "                   std        mean                  <lambda>  \n",
      "use_madl                                                      \n",
      "False     7.477999e+15      99.328                    79.688  \n",
      "True      1.795200e+01     101.328                    82.812  \n",
      "\n",
      "✅ MADL comparison saved to: madl_vs_standard_comparison_20250612_060033.csv\n",
      "✅ Negative returns analysis saved to: negative_returns_analysis_20250612_060033.csv\n",
      "\n",
      "🎉 All exports completed with FIXED Sharpe/Sortino ratios!\n"
     ]
    }
   ],
   "source": [
    "# ========== ENHANCED EXPORT FUNCTION WITH COMPLETE DATA ==========\n",
    "\n",
    "def export_comprehensive_analysis_with_all_data(results_df, portfolio_summary, \n",
    "                                                stat_results, efficiency_df, \n",
    "                                                streak_df, timestamp):\n",
    "    \"\"\"Export all analyses including benchmark, period, and transaction cost data\"\"\"\n",
    "    \n",
    "    filename = f'comprehensive_trading_analysis_{timestamp}.xlsx'\n",
    "    \n",
    "    # First, let's check what columns we have\n",
    "    print(\"\\n📊 Available columns in results_df:\")\n",
    "    essential_columns = [\n",
    "        'benchmark_test_return', 'outperform_benchmark_test', \n",
    "        'transaction_cost_pct', 'spread_pips', 'test_trades', \n",
    "        'period', 'cv_accuracy_mean', 'cv_accuracy_std'\n",
    "    ]\n",
    "    \n",
    "    for col in essential_columns:\n",
    "        if col in results_df.columns:\n",
    "            print(f\"  ✅ {col}\")\n",
    "        else:\n",
    "            print(f\"  ❌ {col} (missing)\")\n",
    "    \n",
    "    with pd.ExcelWriter(filename, engine='openpyxl') as writer:\n",
    "        \n",
    "        # 1. Enhanced Executive Summary with Benchmark Info\n",
    "        exec_summary = []\n",
    "        \n",
    "        # Basic info\n",
    "        exec_summary.append(['EXECUTIVE SUMMARY', ''])\n",
    "        exec_summary.append(['Analysis Date', datetime.now().strftime('%Y-%m-%d %H:%M')])\n",
    "        exec_summary.append(['Total Observations', len(results_df)])\n",
    "        exec_summary.append(['Models Tested', results_df['model'].nunique()])\n",
    "        exec_summary.append(['Currency Pairs', results_df['currency_pair'].nunique()])\n",
    "        \n",
    "        # Period information if available\n",
    "        if 'period' in results_df.columns:\n",
    "            exec_summary.append(['Periods Analyzed', results_df['period'].nunique()])\n",
    "            exec_summary.append(['Period Range', f\"{results_df['period'].min()} to {results_df['period'].max()}\"])\n",
    "        \n",
    "        exec_summary.append(['', ''])\n",
    "        \n",
    "        # Top performers\n",
    "        top_return = results_df.nlargest(1, 'test_total_return').iloc[0]\n",
    "        top_sharpe = results_df.nlargest(1, 'test_sharpe').iloc[0]\n",
    "        \n",
    "        exec_summary.append(['TOP PERFORMERS', ''])\n",
    "        exec_summary.append(['Best Return Model', \n",
    "                            f\"{top_return['model']} ({top_return['test_total_return']:.2f}%)\"])\n",
    "        exec_summary.append(['Best Sharpe Model', \n",
    "                            f\"{top_sharpe['model']} ({top_sharpe['test_sharpe']:.2f})\"])\n",
    "        \n",
    "        # Benchmark comparison\n",
    "        exec_summary.append(['', ''])\n",
    "        exec_summary.append(['BENCHMARK COMPARISON', ''])\n",
    "        \n",
    "        if 'benchmark_test_return' in results_df.columns:\n",
    "            avg_ml_return = results_df['test_total_return'].mean()\n",
    "            avg_bh_return = results_df['benchmark_test_return'].mean()\n",
    "            avg_excess = avg_ml_return - avg_bh_return\n",
    "            \n",
    "            exec_summary.append(['Avg ML Strategy Return', f\"{avg_ml_return:.2f}%\"])\n",
    "            exec_summary.append(['Avg Buy & Hold Return', f\"{avg_bh_return:.2f}%\"])\n",
    "            exec_summary.append(['Avg Excess Return', f\"{avg_excess:+.2f}%\"])\n",
    "            \n",
    "            if 'outperform_benchmark_test' in results_df.columns:\n",
    "                outperform_rate = results_df['outperform_benchmark_test'].mean() * 100\n",
    "                exec_summary.append(['Outperformance Rate', f\"{outperform_rate:.1f}%\"])\n",
    "        else:\n",
    "            exec_summary.append(['Benchmark Data', 'Not Available'])\n",
    "        \n",
    "        # Transaction costs\n",
    "        exec_summary.append(['', ''])\n",
    "        exec_summary.append(['TRANSACTION COSTS', ''])\n",
    "        \n",
    "        if 'transaction_cost_pct' in results_df.columns:\n",
    "            avg_cost = results_df['transaction_cost_pct'].mean() * 100\n",
    "            exec_summary.append(['Avg Transaction Cost', f\"{avg_cost:.4f}%\"])\n",
    "            \n",
    "            if 'test_trades' in results_df.columns:\n",
    "                avg_trades = results_df['test_trades'].mean()\n",
    "                exec_summary.append(['Avg Trades per Period', f\"{avg_trades:.1f}\"])\n",
    "        else:\n",
    "            exec_summary.append(['Transaction Cost Data', 'Not Available'])\n",
    "        \n",
    "        # Accuracy metrics\n",
    "        if 'cv_accuracy_mean' in results_df.columns:\n",
    "            exec_summary.append(['', ''])\n",
    "            exec_summary.append(['ACCURACY METRICS', ''])\n",
    "            avg_accuracy = results_df['cv_accuracy_mean'].mean() * 100\n",
    "            exec_summary.append(['Average CV Accuracy', f\"{avg_accuracy:.1f}%\"])\n",
    "            exec_summary.append(['Accuracy Range', \n",
    "                                f\"{results_df['cv_accuracy_mean'].min()*100:.1f}% - {results_df['cv_accuracy_mean'].max()*100:.1f}%\"])\n",
    "        \n",
    "        pd.DataFrame(exec_summary, columns=['Metric', 'Value']).to_excel(\n",
    "            writer, sheet_name='Executive_Summary', index=False)\n",
    "        \n",
    "        # 2. Raw Results (COMPLETE - this is critical for standalone analysis)\n",
    "        results_df.to_excel(writer, sheet_name='Raw_Results', index=False)\n",
    "        \n",
    "        # 3. Enhanced Portfolio Summary with Benchmark\n",
    "        if 'benchmark_test_return' in results_df.columns and not portfolio_summary.empty:\n",
    "            # Add benchmark columns to portfolio summary\n",
    "            enhanced_portfolio = portfolio_summary.copy()\n",
    "            \n",
    "            # Calculate benchmark stats for each model\n",
    "            benchmark_stats = results_df.groupby('model').agg({\n",
    "                'benchmark_test_return': ['mean', 'std'],\n",
    "                'outperform_benchmark_test': 'mean' if 'outperform_benchmark_test' in results_df.columns else lambda x: np.nan\n",
    "            }).round(3)\n",
    "            \n",
    "            # Flatten multi-level columns\n",
    "            benchmark_stats.columns = ['_'.join(col).strip() for col in benchmark_stats.columns.values]\n",
    "            \n",
    "            # Merge with portfolio summary\n",
    "            enhanced_portfolio = enhanced_portfolio.merge(\n",
    "                benchmark_stats, \n",
    "                left_on='Model', \n",
    "                right_index=True, \n",
    "                how='left', \n",
    "                suffixes=('', '_benchmark')\n",
    "            )\n",
    "            \n",
    "            enhanced_portfolio.to_excel(writer, sheet_name='Portfolio_Summary', index=False)\n",
    "        else:\n",
    "            # If portfolio_summary is empty or no benchmark data, just save what we have\n",
    "            if not portfolio_summary.empty:\n",
    "                portfolio_summary.to_excel(writer, sheet_name='Portfolio_Summary', index=False)\n",
    "            else:\n",
    "                # Create a basic portfolio summary from results_df\n",
    "                basic_portfolio = results_df.groupby('model').agg({\n",
    "                    'test_total_return': ['mean', 'std', 'count'],\n",
    "                    'test_sharpe': 'mean',\n",
    "                    'test_sortino': 'mean',\n",
    "                    'test_max_drawdown': 'mean'\n",
    "                }).round(3)\n",
    "                basic_portfolio.columns = ['_'.join(col).strip() for col in basic_portfolio.columns.values]\n",
    "                basic_portfolio.reset_index(inplace=True)\n",
    "                basic_portfolio.to_excel(writer, sheet_name='Portfolio_Summary', index=False)\n",
    "        \n",
    "        # 4. Statistical Tests\n",
    "        if stat_results:\n",
    "            pd.DataFrame(stat_results).to_excel(writer, sheet_name='Statistical_Tests', index=False)\n",
    "        \n",
    "        # 5. Forecast Efficiency\n",
    "        efficiency_df.to_excel(writer, sheet_name='Forecast_Efficiency', index=False)\n",
    "        \n",
    "        # 6. Win/Loss Streaks\n",
    "        streak_df.to_excel(writer, sheet_name='Win_Loss_Streaks', index=False)\n",
    "        \n",
    "        # 7. Model Comparison with Benchmark\n",
    "        model_comparison_cols = {\n",
    "            'test_total_return': ['mean', 'std', 'min', 'max', 'count'],\n",
    "            'test_sharpe': ['mean', 'std'],\n",
    "            'test_max_drawdown': 'mean',\n",
    "            'test_cvar_95': lambda x: x.mean() * 100 if not x.isna().all() else np.nan\n",
    "        }\n",
    "        \n",
    "        # Add benchmark columns if available\n",
    "        if 'benchmark_test_return' in results_df.columns:\n",
    "            model_comparison_cols['benchmark_test_return'] = ['mean', 'std']\n",
    "            \n",
    "        if 'outperform_benchmark_test' in results_df.columns:\n",
    "            model_comparison_cols['outperform_benchmark_test'] = lambda x: x.mean() * 100\n",
    "            \n",
    "        if 'cv_accuracy_mean' in results_df.columns:\n",
    "            model_comparison_cols['cv_accuracy_mean'] = 'mean'\n",
    "            model_comparison_cols['cv_accuracy_std'] = 'mean'\n",
    "            \n",
    "        if 'transaction_cost_pct' in results_df.columns:\n",
    "            model_comparison_cols['transaction_cost_pct'] = lambda x: x.mean() * 100\n",
    "            \n",
    "        if 'test_trades' in results_df.columns:\n",
    "            model_comparison_cols['test_trades'] = 'mean'\n",
    "        \n",
    "        model_comparison = results_df.groupby('model').agg(model_comparison_cols).round(3)\n",
    "        model_comparison.to_excel(writer, sheet_name='Model_Comparison')\n",
    "        \n",
    "        # 8. Currency Analysis with Benchmark\n",
    "        currency_agg = {\n",
    "            'test_total_return': 'mean',\n",
    "            'test_sharpe': 'mean',\n",
    "            'test_sortino': 'mean'\n",
    "        }\n",
    "        \n",
    "        if 'benchmark_test_return' in results_df.columns:\n",
    "            currency_agg['benchmark_test_return'] = 'mean'\n",
    "            \n",
    "        if 'outperform_benchmark_test' in results_df.columns:\n",
    "            currency_agg['outperform_benchmark_test'] = lambda x: x.mean() * 100\n",
    "            \n",
    "        if 'cv_accuracy_mean' in results_df.columns:\n",
    "            currency_agg['cv_accuracy_mean'] = 'mean'\n",
    "            \n",
    "        if 'transaction_cost_pct' in results_df.columns:\n",
    "            currency_agg['transaction_cost_pct'] = lambda x: x.mean() * 100\n",
    "            \n",
    "        if 'spread_pips' in results_df.columns:\n",
    "            currency_agg['spread_pips'] = 'mean'\n",
    "        \n",
    "        currency_analysis = results_df.groupby(['currency_pair', 'model']).agg(currency_agg).round(3)\n",
    "        currency_analysis.to_excel(writer, sheet_name='Currency_Analysis')\n",
    "        \n",
    "        # 9. Period Analysis with Benchmark\n",
    "        if 'period' in results_df.columns:\n",
    "            period_agg = {\n",
    "                'test_total_return': 'mean',\n",
    "                'test_sharpe': 'mean'\n",
    "            }\n",
    "            \n",
    "            if 'benchmark_test_return' in results_df.columns:\n",
    "                period_agg['benchmark_test_return'] = 'mean'\n",
    "                \n",
    "            if 'outperform_benchmark_test' in results_df.columns:\n",
    "                period_agg['outperform_benchmark_test'] = lambda x: x.mean() * 100\n",
    "                \n",
    "            if 'cv_accuracy_mean' in results_df.columns:\n",
    "                period_agg['cv_accuracy_mean'] = 'mean'\n",
    "            \n",
    "            period_analysis = results_df.groupby(['period', 'model']).agg(period_agg).round(3)\n",
    "            period_analysis.to_excel(writer, sheet_name='Period_Analysis')\n",
    "            \n",
    "            # Also create period summary\n",
    "            period_summary = results_df.groupby('period').agg({\n",
    "                'test_total_return': ['mean', 'std', 'count'],\n",
    "                'test_sharpe': 'mean',\n",
    "                'benchmark_test_return': 'mean' if 'benchmark_test_return' in results_df.columns else lambda x: np.nan\n",
    "            }).round(3)\n",
    "            period_summary.to_excel(writer, sheet_name='Period_Summary')\n",
    "        \n",
    "        # 10. Benchmark Analysis Sheet\n",
    "        if 'benchmark_test_return' in results_df.columns:\n",
    "            benchmark_analysis = create_benchmark_analysis_sheet(results_df)\n",
    "            benchmark_analysis.to_excel(writer, sheet_name='Benchmark_Analysis', index=False)\n",
    "        \n",
    "        # 11. Transaction Cost Analysis Sheet\n",
    "        if 'transaction_cost_pct' in results_df.columns or 'spread_pips' in results_df.columns:\n",
    "            cost_analysis = create_transaction_cost_sheet(results_df)\n",
    "            cost_analysis.to_excel(writer, sheet_name='Transaction_Costs', index=False)\n",
    "        \n",
    "        # 12. Accuracy Analysis (if available)\n",
    "        if 'cv_accuracy_mean' in results_df.columns:\n",
    "            accuracy_analysis = create_accuracy_analysis_sheet(results_df)\n",
    "            accuracy_analysis.to_excel(writer, sheet_name='Accuracy_Analysis', index=False)\n",
    "        \n",
    "        # 13. Risk Metrics Detail\n",
    "        if 'test_var_95' in results_df.columns:\n",
    "            risk_detail = results_df.groupby('model').agg({\n",
    "                'test_var_95': lambda x: x.mean() * 100,\n",
    "                'test_cvar_95': lambda x: x.mean() * 100,\n",
    "                'test_max_drawdown': lambda x: x.mean() * 100\n",
    "            }).round(3)\n",
    "            risk_detail.to_excel(writer, sheet_name='Risk_Detail')\n",
    "        \n",
    "        # 14. Model Rankings\n",
    "        rankings_df = create_model_rankings_sheet(results_df)\n",
    "        rankings_df.to_excel(writer, sheet_name='Model_Rankings', index=False)\n",
    "    \n",
    "    print(f\"✅ Comprehensive analysis exported to: {filename}\")\n",
    "    return filename\n",
    "\n",
    "\n",
    "def create_benchmark_analysis_sheet(results_df):\n",
    "    \"\"\"Create detailed benchmark analysis sheet\"\"\"\n",
    "    benchmark_data = []\n",
    "    \n",
    "    for model in results_df['model'].unique():\n",
    "        model_data = results_df[results_df['model'] == model]\n",
    "        \n",
    "        row = {\n",
    "            'Model': model,\n",
    "            'Observations': len(model_data),\n",
    "            'Avg_ML_Return': model_data['test_total_return'].mean(),\n",
    "            'Avg_BH_Return': model_data['benchmark_test_return'].mean(),\n",
    "            'Excess_Return': model_data['test_total_return'].mean() - model_data['benchmark_test_return'].mean(),\n",
    "            'Excess_Return_Std': (model_data['test_total_return'] - model_data['benchmark_test_return']).std(),\n",
    "            'Information_Ratio': np.nan,  # Will calculate below\n",
    "            'Outperform_Rate': np.nan,\n",
    "            'Avg_ML_Sharpe': model_data['test_sharpe'].mean(),\n",
    "            'ML_Win_Rate': (model_data['test_total_return'] > 0).mean() * 100,\n",
    "            'BH_Win_Rate': (model_data['benchmark_test_return'] > 0).mean() * 100\n",
    "        }\n",
    "        \n",
    "        # Calculate Information Ratio\n",
    "        excess_returns = model_data['test_total_return'] - model_data['benchmark_test_return']\n",
    "        if len(excess_returns) > 1 and excess_returns.std() > 0:\n",
    "            row['Information_Ratio'] = excess_returns.mean() / excess_returns.std()\n",
    "        \n",
    "        # Add outperformance rate if available\n",
    "        if 'outperform_benchmark_test' in results_df.columns:\n",
    "            row['Outperform_Rate'] = model_data['outperform_benchmark_test'].mean() * 100\n",
    "        \n",
    "        benchmark_data.append(row)\n",
    "    \n",
    "    benchmark_df = pd.DataFrame(benchmark_data)\n",
    "    benchmark_df = benchmark_df.sort_values('Excess_Return', ascending=False)\n",
    "    \n",
    "    return benchmark_df.round(3)\n",
    "\n",
    "\n",
    "def create_transaction_cost_sheet(results_df):\n",
    "    \"\"\"Create detailed transaction cost analysis sheet\"\"\"\n",
    "    cost_data = []\n",
    "    \n",
    "    for model in results_df['model'].unique():\n",
    "        model_data = results_df[results_df['model'] == model]\n",
    "        \n",
    "        row = {\n",
    "            'Model': model,\n",
    "            'Observations': len(model_data),\n",
    "            'Avg_Return': model_data['test_total_return'].mean(),\n",
    "            'Avg_Trades': np.nan,\n",
    "            'Avg_Cost_Pct': np.nan,\n",
    "            'Total_Cost_Impact': np.nan,\n",
    "            'Return_Per_Trade': np.nan,\n",
    "            'Cost_Efficiency': np.nan,\n",
    "            'Avg_Spread_Pips': np.nan\n",
    "        }\n",
    "        \n",
    "        if 'test_trades' in results_df.columns:\n",
    "            row['Avg_Trades'] = model_data['test_trades'].mean()\n",
    "            if row['Avg_Trades'] > 0:\n",
    "                row['Return_Per_Trade'] = row['Avg_Return'] / row['Avg_Trades']\n",
    "        \n",
    "        if 'transaction_cost_pct' in results_df.columns:\n",
    "            row['Avg_Cost_Pct'] = model_data['transaction_cost_pct'].mean() * 100\n",
    "            \n",
    "            if 'test_trades' in results_df.columns and row['Avg_Trades'] > 0:\n",
    "                row['Total_Cost_Impact'] = row['Avg_Cost_Pct'] * row['Avg_Trades']\n",
    "                row['Cost_Efficiency'] = row['Avg_Return'] / row['Total_Cost_Impact'] if row['Total_Cost_Impact'] > 0 else np.nan\n",
    "        \n",
    "        if 'spread_pips' in results_df.columns:\n",
    "            row['Avg_Spread_Pips'] = model_data['spread_pips'].mean()\n",
    "        \n",
    "        cost_data.append(row)\n",
    "    \n",
    "    cost_df = pd.DataFrame(cost_data)\n",
    "    cost_df = cost_df.sort_values('Cost_Efficiency', ascending=False, na_position='last')\n",
    "    \n",
    "    return cost_df.round(3)\n",
    "\n",
    "\n",
    "# ========== EXPORT INDIVIDUAL DATA FILES FOR STANDALONE ANALYSIS ==========\n",
    "\n",
    "def export_data_for_standalone_analysis(results_df, timestamp):\n",
    "    \"\"\"Export individual CSV files with all necessary columns for standalone analysis\"\"\"\n",
    "    \n",
    "    print(\"\\n📁 Exporting data files for standalone analysis...\")\n",
    "    \n",
    "    # 1. Export complete raw results (most important)\n",
    "    results_df.to_csv(f'complete_results_data_{timestamp}.csv', index=False)\n",
    "    print(f\"✅ Complete results data exported\")\n",
    "    \n",
    "    # 2. Export model summary with benchmark\n",
    "    model_summary = results_df.groupby('model').agg({\n",
    "        'test_total_return': ['mean', 'std', 'count'],\n",
    "        'test_sharpe': 'mean',\n",
    "        'test_sortino': 'mean',\n",
    "        'test_max_drawdown': 'mean',\n",
    "        'benchmark_test_return': 'mean' if 'benchmark_test_return' in results_df.columns else lambda x: np.nan,\n",
    "        'outperform_benchmark_test': lambda x: x.mean() * 100 if 'outperform_benchmark_test' in results_df.columns else np.nan,\n",
    "        'transaction_cost_pct': lambda x: x.mean() * 100 if 'transaction_cost_pct' in results_df.columns else np.nan,\n",
    "        'test_trades': 'mean' if 'test_trades' in results_df.columns else lambda x: np.nan,\n",
    "        'cv_accuracy_mean': lambda x: x.mean() * 100 if 'cv_accuracy_mean' in results_df.columns else np.nan\n",
    "    }).round(4)\n",
    "    \n",
    "    model_summary.columns = ['_'.join(col).strip() for col in model_summary.columns.values]\n",
    "    model_summary.to_csv(f'model_summary_with_benchmark_{timestamp}.csv')\n",
    "    print(f\"✅ Model summary with benchmark exported\")\n",
    "    \n",
    "    # 3. Export currency summary with all metrics\n",
    "    currency_summary = results_df.groupby('currency_pair').agg({\n",
    "        'test_total_return': ['mean', 'std', 'count'],\n",
    "        'test_sharpe': 'mean',\n",
    "        'benchmark_test_return': 'mean' if 'benchmark_test_return' in results_df.columns else lambda x: np.nan,\n",
    "        'transaction_cost_pct': lambda x: x.mean() * 100 if 'transaction_cost_pct' in results_df.columns else np.nan,\n",
    "        'spread_pips': 'mean' if 'spread_pips' in results_df.columns else lambda x: np.nan\n",
    "    }).round(4)\n",
    "    \n",
    "    currency_summary.columns = ['_'.join(col).strip() for col in currency_summary.columns.values]\n",
    "    currency_summary.to_csv(f'currency_summary_complete_{timestamp}.csv')\n",
    "    print(f\"✅ Currency summary exported\")\n",
    "    \n",
    "    # 4. Export period summary if available\n",
    "    if 'period' in results_df.columns:\n",
    "        period_summary = results_df.groupby('period').agg({\n",
    "            'test_total_return': ['mean', 'std', 'count'],\n",
    "            'test_sharpe': 'mean',\n",
    "            'benchmark_test_return': 'mean' if 'benchmark_test_return' in results_df.columns else lambda x: np.nan\n",
    "        }).round(4)\n",
    "        \n",
    "        period_summary.columns = ['_'.join(col).strip() for col in period_summary.columns.values]\n",
    "        period_summary.to_csv(f'period_summary_{timestamp}.csv')\n",
    "        print(f\"✅ Period summary exported\")\n",
    "    \n",
    "    # 5. Export model-currency matrix\n",
    "    model_currency_matrix = results_df.pivot_table(\n",
    "        values='test_total_return',\n",
    "        index='model',\n",
    "        columns='currency_pair',\n",
    "        aggfunc='mean'\n",
    "    ).round(2)\n",
    "    model_currency_matrix.to_csv(f'model_currency_performance_matrix_{timestamp}.csv')\n",
    "    print(f\"✅ Model-currency performance matrix exported\")\n",
    "    \n",
    "    # 6. Export benchmark comparison if available\n",
    "    if 'benchmark_test_return' in results_df.columns:\n",
    "        benchmark_comparison = results_df.groupby(['model', 'currency_pair']).agg({\n",
    "            'test_total_return': 'mean',\n",
    "            'benchmark_test_return': 'mean',\n",
    "            'outperform_benchmark_test': 'mean' if 'outperform_benchmark_test' in results_df.columns else lambda x: np.nan\n",
    "        }).round(4)\n",
    "        \n",
    "        benchmark_comparison['excess_return'] = (benchmark_comparison['test_total_return'] - \n",
    "                                                benchmark_comparison['benchmark_test_return'])\n",
    "        benchmark_comparison.to_csv(f'benchmark_comparison_detailed_{timestamp}.csv')\n",
    "        print(f\"✅ Benchmark comparison exported\")\n",
    "    \n",
    "    print(f\"\\n📊 All data files exported with timestamp: {timestamp}\")\n",
    "    \n",
    "    return True\n",
    "\n",
    "\n",
    "# ========== SIMPLE DIRECT EXPORT FUNCTION ==========\n",
    "\n",
    "def export_all_results_simple(results_df):\n",
    "    \"\"\"\n",
    "    Simple export function that just needs results_df\n",
    "    Perfect for when you just want to export everything without running analysis\n",
    "    \"\"\"\n",
    "    timestamp = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\n",
    "    \n",
    "    print(\"\\n📊 Simple Export - Checking available columns:\")\n",
    "    essential_columns = [\n",
    "        'benchmark_test_return', 'outperform_benchmark_test', \n",
    "        'transaction_cost_pct', 'spread_pips', 'test_trades', \n",
    "        'period', 'cv_accuracy_mean', 'cv_accuracy_std'\n",
    "    ]\n",
    "    \n",
    "    for col in essential_columns:\n",
    "        if col in results_df.columns:\n",
    "            print(f\"  ✅ {col}\")\n",
    "        else:\n",
    "            print(f\"  ❌ {col} (missing)\")\n",
    "    \n",
    "    # 1. Export complete raw data (MOST IMPORTANT)\n",
    "    results_df.to_csv(f'complete_results_data_{timestamp}.csv', index=False)\n",
    "    print(f\"\\n✅ Complete results exported to: complete_results_data_{timestamp}.csv\")\n",
    "    \n",
    "    # 2. Create comprehensive Excel file\n",
    "    with pd.ExcelWriter(f'comprehensive_analysis_{timestamp}.xlsx', engine='openpyxl') as writer:\n",
    "        \n",
    "        # Raw results\n",
    "        results_df.to_excel(writer, sheet_name='Raw_Results', index=False)\n",
    "        \n",
    "        # Model summary\n",
    "        model_summary = results_df.groupby('model').agg({\n",
    "            'test_total_return': ['mean', 'std', 'count'],\n",
    "            'test_sharpe': 'mean',\n",
    "            'test_sortino': 'mean',\n",
    "            'test_max_drawdown': 'mean',\n",
    "            'benchmark_test_return': 'mean' if 'benchmark_test_return' in results_df.columns else lambda x: np.nan,\n",
    "            'cv_accuracy_mean': lambda x: x.mean() * 100 if 'cv_accuracy_mean' in results_df.columns else np.nan\n",
    "        }).round(3)\n",
    "        model_summary.columns = ['_'.join(col).strip() for col in model_summary.columns.values]\n",
    "        model_summary.to_excel(writer, sheet_name='Model_Summary')\n",
    "        \n",
    "        # Currency analysis\n",
    "        currency_summary = results_df.groupby('currency_pair').agg({\n",
    "            'test_total_return': ['mean', 'std', 'count'],\n",
    "            'test_sharpe': 'mean',\n",
    "            'benchmark_test_return': 'mean' if 'benchmark_test_return' in results_df.columns else lambda x: np.nan\n",
    "        }).round(3)\n",
    "        currency_summary.columns = ['_'.join(col).strip() for col in currency_summary.columns.values]\n",
    "        currency_summary.to_excel(writer, sheet_name='Currency_Summary')\n",
    "        \n",
    "        # Period analysis if available\n",
    "        if 'period' in results_df.columns:\n",
    "            period_summary = results_df.groupby('period').agg({\n",
    "                'test_total_return': ['mean', 'std', 'count'],\n",
    "                'test_sharpe': 'mean',\n",
    "                'benchmark_test_return': 'mean' if 'benchmark_test_return' in results_df.columns else lambda x: np.nan\n",
    "            }).round(3)\n",
    "            period_summary.columns = ['_'.join(col).strip() for col in period_summary.columns.values]\n",
    "            period_summary.to_excel(writer, sheet_name='Period_Summary')\n",
    "        \n",
    "        # Benchmark analysis if available\n",
    "        if 'benchmark_test_return' in results_df.columns:\n",
    "            benchmark_analysis = create_benchmark_analysis_sheet(results_df)\n",
    "            benchmark_analysis.to_excel(writer, sheet_name='Benchmark_Analysis', index=False)\n",
    "        \n",
    "        # Transaction cost analysis if available\n",
    "        if 'transaction_cost_pct' in results_df.columns or 'spread_pips' in results_df.columns:\n",
    "            cost_analysis = create_transaction_cost_sheet(results_df)\n",
    "            cost_analysis.to_excel(writer, sheet_name='Transaction_Costs', index=False)\n",
    "    \n",
    "    print(f\"✅ Comprehensive Excel file: comprehensive_analysis_{timestamp}.xlsx\")\n",
    "    \n",
    "    # 3. Export individual CSV files\n",
    "    export_data_for_standalone_analysis(results_df, timestamp)\n",
    "    \n",
    "    print(f\"\\n🎉 All data exported successfully!\")\n",
    "    print(f\"📁 Files created:\")\n",
    "    print(f\"  • complete_results_data_{timestamp}.csv (for standalone analysis)\")\n",
    "    print(f\"  • comprehensive_analysis_{timestamp}.xlsx (with multiple sheets)\")\n",
    "    print(f\"  • Various individual CSV files\")\n",
    "    \n",
    "    return timestamp\n",
    "\n",
    "\n",
    "print(\"✅ Enhanced export functions loaded!\")\n",
    "print(\"\\n🚀 Key improvements:\")\n",
    "print(\"  📈 Complete benchmark data export (benchmark_test_return, outperform_benchmark_test)\")\n",
    "print(\"  📅 Period information preserved and analyzed\")\n",
    "print(\"  💰 Transaction cost data fully exported\")\n",
    "print(\"  📊 All columns needed for standalone analysis preserved\")\n",
    "print(\"  📁 Individual CSV exports for flexible analysis\")\n",
    "print(\"\\n💡 SIMPLE USAGE:\")\n",
    "print(\"  timestamp = export_all_results_simple(results_df)\")\n",
    "print(\"\\n💡 Or use export_data_for_standalone_analysis() for just CSV files\")\n",
    "\n",
    "# ========== ENHANCED EXPORT WITH FIXED SHARPE/SORTINO DATA ==========\n",
    "\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from datetime import datetime\n",
    "\n",
    "# Load the FIXED data file\n",
    "print(\"📊 Loading fixed results data...\")\n",
    "results_df = pd.read_excel('ml_trading_results_FIXED.xlsx')\n",
    "print(f\"✅ Loaded {len(results_df)} rows from FIXED file\")\n",
    "\n",
    "# Quick check to verify the fixes worked\n",
    "print(\"\\n🔍 Verifying Sharpe/Sortino fixes:\")\n",
    "negative_returns = results_df[results_df['test_total_return'] < 0]\n",
    "if len(negative_returns) > 0:\n",
    "    sample = negative_returns[['currency_pair', 'model', 'test_total_return', 'test_sharpe', 'test_sortino']].head(3)\n",
    "    print(\"Sample of fixed negative return cases:\")\n",
    "    print(sample)\n",
    "    \n",
    "    # Check if fixes are applied\n",
    "    if all(negative_returns['test_sharpe'] < 0):\n",
    "        print(\"✅ All negative returns now have negative Sharpe ratios!\")\n",
    "    else:\n",
    "        print(\"⚠️ Some negative returns still have positive Sharpe ratios\")\n",
    "\n",
    "# Now run the simple export function\n",
    "print(\"\\n🚀 Starting comprehensive export...\")\n",
    "timestamp = export_all_results_simple(results_df)\n",
    "\n",
    "print(f\"\\n✅ Export completed successfully!\")\n",
    "print(f\"📁 All files created with timestamp: {timestamp}\")\n",
    "\n",
    "# Additional analysis specific to MADL vs Standard\n",
    "print(\"\\n📊 MADL vs Standard Logistic Comparison:\")\n",
    "if 'use_madl' in results_df.columns:\n",
    "    madl_comparison = results_df[results_df['model'].str.contains('Logistic')].groupby('use_madl').agg({\n",
    "        'test_total_return': ['mean', 'std', 'count'],\n",
    "        'test_sharpe': ['mean', 'std'],\n",
    "        'test_sortino': ['mean', 'std'],\n",
    "        'test_trades': 'mean',\n",
    "        'outperform_benchmark_test': lambda x: x.mean() * 100 if 'outperform_benchmark_test' in results_df.columns else np.nan\n",
    "    }).round(3)\n",
    "    \n",
    "    print(\"\\nMADL Performance Summary:\")\n",
    "    print(madl_comparison)\n",
    "    \n",
    "    # Save MADL comparison separately\n",
    "    madl_comparison.to_csv(f'madl_vs_standard_comparison_{timestamp}.csv')\n",
    "    print(f\"\\n✅ MADL comparison saved to: madl_vs_standard_comparison_{timestamp}.csv\")\n",
    "\n",
    "# Create a special summary for negative return cases\n",
    "negative_summary = results_df[results_df['test_total_return'] < 0].groupby(['currency_pair', 'model']).agg({\n",
    "    'test_total_return': 'mean',\n",
    "    'test_sharpe': 'mean',\n",
    "    'test_sortino': 'mean',\n",
    "    'test_trades': 'mean',\n",
    "    'benchmark_test_return': 'mean' if 'benchmark_test_return' in results_df.columns else lambda x: np.nan\n",
    "}).round(3)\n",
    "\n",
    "if len(negative_summary) > 0:\n",
    "    negative_summary.to_csv(f'negative_returns_analysis_{timestamp}.csv')\n",
    "    print(f\"✅ Negative returns analysis saved to: negative_returns_analysis_{timestamp}.csv\")\n",
    "\n",
    "print(\"\\n🎉 All exports completed with FIXED Sharpe/Sortino ratios!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "d3c190da-64fe-47a5-b4f7-1447931ead5c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "📊 Simple Export - Checking available columns:\n",
      "  ✅ benchmark_test_return\n",
      "  ✅ outperform_benchmark_test\n",
      "  ✅ transaction_cost_pct\n",
      "  ✅ spread_pips\n",
      "  ✅ test_trades\n",
      "  ✅ period\n",
      "  ✅ cv_accuracy_mean\n",
      "  ✅ cv_accuracy_std\n",
      "\n",
      "✅ Complete results exported to: complete_results_data_20250612_060038.csv\n",
      "✅ Comprehensive Excel file: comprehensive_analysis_20250612_060038.xlsx\n",
      "\n",
      "📁 Exporting data files for standalone analysis...\n",
      "✅ Complete results data exported\n",
      "✅ Model summary with benchmark exported\n",
      "✅ Currency summary exported\n",
      "✅ Period summary exported\n",
      "✅ Model-currency performance matrix exported\n",
      "✅ Benchmark comparison exported\n",
      "\n",
      "📊 All data files exported with timestamp: 20250612_060038\n",
      "\n",
      "🎉 All data exported successfully!\n",
      "📁 Files created:\n",
      "  • complete_results_data_20250612_060038.csv (for standalone analysis)\n",
      "  • comprehensive_analysis_20250612_060038.xlsx (with multiple sheets)\n",
      "  • Various individual CSV files\n"
     ]
    }
   ],
   "source": [
    "# Simple export - just needs results_df\n",
    "timestamp = export_all_results_simple(results_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0d9d0e68-97b4-4dfb-841b-a0119fed96c6",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:base] *",
   "language": "python",
   "name": "conda-base-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
